From: Guennadi Liakhovetski Date: Mon, 15 Mar 2021 16:39:32 +0000 (-0500) Subject: ASoC: SOF: remove superfluous NULL check in debugfs read X-Git-Tag: accepted/tizen/unified/20230118.172025~7091^2~1^2~174^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97f53046d746bef513d5fbaac53eedb011968407;p=platform%2Fkernel%2Flinux-rpi.git ASoC: SOF: remove superfluous NULL check in debugfs read When reading from IPC flood debugfs entries no need to check whether .cache_buf is NULL - it's impossible since otherwise the initialisation would have failed. This also fixes a klocwork reported issue: passed to function and may be dereferenced there by passing argument 2 to function 'memcpy' at line 510. sound/soc/sof/debug.c:510 | sof_dfsentry_read() Reported-by: Keqiao Zhang Reviewed-by: Ranjani Sridharan Reviewed-by: Xiuli Pan Signed-off-by: Guennadi Liakhovetski Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20210315163932.18663-4-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown --- diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c index 778c7d0..a51a928 100644 --- a/sound/soc/sof/debug.c +++ b/sound/soc/sof/debug.c @@ -451,8 +451,7 @@ static ssize_t sof_dfsentry_read(struct file *file, char __user *buffer, dentry = file->f_path.dentry; if ((!strcmp(dentry->d_name.name, "ipc_flood_count") || - !strcmp(dentry->d_name.name, "ipc_flood_duration_ms")) && - dfse->cache_buf) { + !strcmp(dentry->d_name.name, "ipc_flood_duration_ms"))) { if (*ppos) return 0;