linux/drivers/hwtracing/coresight
Suzuki K Poulose 17c20f329a coresight: tmc: Smatch: Fix potential NULL pointer dereference
Based on the following report from Smatch, fix the potential
NULL pointer dereference check.

The patch 743256e214e8: "coresight: tmc: Clean up device specific
data" from May 22, 2019, leads to the following Smatch complaint:

    drivers/hwtracing/coresight/coresight-tmc-etr.c:625 tmc_etr_free_flat_buf()
    warn: variable dereferenced before check 'flat_buf' (see line 623)

drivers/hwtracing/coresight/coresight-tmc-etr.c
   622		struct etr_flat_buf *flat_buf = etr_buf->private;
   623		struct device *real_dev = flat_buf->dev->parent;
                                          ^^^^^^^^^^
The patch introduces a new NULL check

   624
   625		if (flat_buf && flat_buf->daddr)
                    ^^^^^^^^
but the existing code assumed it can be NULL.

   626			dma_free_coherent(real_dev, flat_buf->size,
   627					  flat_buf->vaddr, flat_buf->daddr);

Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20190621175205.24551-3-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-03 21:16:37 +02:00
..
coresight-catu.c coresight: Use platform agnostic names 2019-06-20 07:56:13 +02:00
coresight-catu.h coresight: catu: Cleanup device specific data 2019-06-19 20:29:14 +02:00
coresight-cpu-debug.c coresight: Make device to CPU mapping generic 2019-06-20 07:56:11 +02:00
coresight-etb10.c coresight: etb10: Do not call smp_processor_id from preemptible 2019-07-03 21:15:33 +02:00
coresight-etm3x-sysfs.c coresight: etm: Clean up device specific data 2019-06-19 20:29:14 +02:00
coresight-etm3x.c coresight: etm3x: Smatch: Fix potential NULL pointer dereference 2019-07-03 21:16:36 +02:00
coresight-etm4x-sysfs.c coresight: etm4x: Don't use contextID with PID namespaces 2018-07-15 13:52:56 +02:00
coresight-etm4x.c coresight: Use platform agnostic names 2019-06-20 07:56:13 +02:00
coresight-etm4x.h coresight: etm: Clean up device specific data 2019-06-19 20:29:14 +02:00
coresight-etm-cp14.c coresight: Moving framework and drivers to SPDX identifier 2018-05-14 16:19:59 +02:00
coresight-etm-perf.c coresight: Use coresight device names for sinks in PMU attribute 2019-06-19 20:29:14 +02:00
coresight-etm-perf.h coresight: perf: Add "sinks" group to PMU directory 2019-02-08 12:27:36 +01:00
coresight-etm.h coresight: etm: Clean up device specific data 2019-06-19 20:29:14 +02:00
coresight-funnel.c coresight: Potential uninitialized variable in probe() 2019-07-03 21:15:33 +02:00
coresight-platform.c coresight: Add dummy definition for of_coresight_get_cpu() 2019-06-20 07:56:15 +02:00
coresight-priv.h coresight: Use fwnode handle instead of device names 2019-06-20 07:56:13 +02:00
coresight-replicator.c coresight: replicator: Add terminate entry for acpi_device_id tables 2019-06-20 08:06:56 +02:00
coresight-stm.c coresight: stm: ACPI support for parsing stimulus base 2019-06-20 07:56:14 +02:00
coresight-tmc-etf.c coresight: tmc-etf: Do not call smp_processor_id from preemptible 2019-07-03 21:15:33 +02:00
coresight-tmc-etr.c coresight: tmc: Smatch: Fix potential NULL pointer dereference 2019-07-03 21:16:37 +02:00
coresight-tmc.c coresight: Use platform agnostic names 2019-06-20 07:56:13 +02:00
coresight-tmc.h coresight: tmc: Clean up device specific data 2019-06-19 20:29:14 +02:00
coresight-tpiu.c coresight: Use platform agnostic names 2019-06-20 07:56:13 +02:00
coresight.c coresight: Use platform agnostic names 2019-06-20 07:56:13 +02:00
Kconfig coresight: platform: add OF/APCI dependency 2019-06-20 08:06:56 +02:00
Makefile coresight: Rename of_coresight to coresight-platform 2019-06-20 07:56:10 +02:00