coresight: Add Null check before accessing pointer buf

Add NULL check to avoid potential NULL pointer dereference for
"buf"  pointer.

Change-Id: I80b29fdacfd8a95a895a32f30b99eb00b3fc2f55
Signed-off-by: Saurabh Ambulkar <sambulka@codeaurora.org>
This commit is contained in:
Saurabh Ambulkar 2021-07-28 19:57:55 +05:30 • committed by Gerrit - the friendly Code Review server
commit be06049ea6

View file

@ -237,6 +237,9 @@ static int tmc_enable_etf_sink_perf(struct coresight_device *csdev, void *data)
struct perf_output_handle *handle = data;
struct cs_buffers *buf = etm_perf_sink_config(handle);
if (!buf)
return -EINVAL;
spin_lock_irqsave(&drvdata->spinlock, flags);
do {
ret = -EINVAL;