coresight-tmc: Fix false positive -Wfortify-source

The size is checked just above.

../drivers/hwtracing/coresight/coresight-tmc.c:423:26: warning: 'sscanf' may overflow; destination buffer in argument 3 has size 10, but the corresponding specifier may require size 11 [-Wfortify-source]
  423 |         if (sscanf(buf, "%10s", str) != 1)
      |                                 ^
../drivers/hwtracing/coresight/coresight-tmc.c:464:26: warning: 'sscanf' may overflow; destination buffer in argument 3 has size 10, but the corresponding specifier may require size 11 [-Wfortify-source]
  464 |         if (sscanf(buf, "%10s", str) != 1)
      |                                 ^
2 warnings generated.

Change-Id: I5db199a85ba0c7dfc15fae5d62c9c4d8c550d3e7
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
This commit is contained in:
Alexander Winkowski 2024-03-04 17:51:12 +00:00
commit 4f5bf3d147
No known key found for this signature in database
GPG key ID: 72762A66704CDE44

View file

@ -420,7 +420,7 @@ static ssize_t out_mode_store(struct device *dev,
if (strlen(buf) >= 10)
return -EINVAL;
if (sscanf(buf, "%10s", str) != 1)
if (sscanf(buf, "%s", str) != 1)
return -EINVAL;
ret = tmc_etr_switch_mode(drvdata, str);
return ret ? ret : size;
@ -461,7 +461,7 @@ static ssize_t pcie_path_store(struct device *dev,
if (strlen(buf) >= 10)
return -EINVAL;
if (sscanf(buf, "%10s", str) != 1)
if (sscanf(buf, "%s", str) != 1)
return -EINVAL;
mutex_lock(&drvdata->mem_lock);