]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
OPP: debugfs: Fix warning with W=1 builds
authorViresh Kumar <viresh.kumar@linaro.org>
Wed, 27 Sep 2023 10:58:16 +0000 (16:28 +0530)
committerViresh Kumar <viresh.kumar@linaro.org>
Fri, 6 Oct 2023 07:07:34 +0000 (12:37 +0530)
We currently get the following warning:

debugfs.c: In function ‘opp_debug_create_one’:
debugfs.c:63:42: warning: ‘%.1d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 2 [-Wformat-truncation=]
   snprintf(name, sizeof(name), "icc-path-%.1d", i);
                                          ^~~~
debugfs.c:63:32: note: directive argument in the range [0, 2147483647]
   snprintf(name, sizeof(name), "icc-path-%.1d", i);
                                ^~~~~~~~~~~~~~~
debugfs.c:63:3: note: ‘snprintf’ output between 11 and 20 bytes into a destination of size 11
   snprintf(name, sizeof(name), "icc-path-%.1d", i);

Fix it by increasing size of the `name` array.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/opp/debugfs.c

index 17543c0aa5b6810bbe39170b5979ff0da2e2d2ad..ec030b19164a3b75f839fac88b00e3c16cb970d0 100644 (file)
@@ -56,7 +56,7 @@ static void opp_debug_create_bw(struct dev_pm_opp *opp,
                                struct dentry *pdentry)
 {
        struct dentry *d;
-       char name[11];
+       char name[20];
        int i;
 
        for (i = 0; i < opp_table->path_count; i++) {