Re: [PATCH v2 6/7] of: Fix potential wrong MODALIAS uevent value

From: kernel test robot
Date: Sun Dec 15 2024 - 22:42:33 EST


Hi Zijun,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 0f7ca6f69354e0c3923bbc28c92d0ecab4d50a3e]

url: https://github.com/intel-lab-lkp/linux/commits/Zijun-Hu/of-Fix-API-of_find_node_opts_by_path-finding-OF-device-node-failure/20241216-084408
base: 0f7ca6f69354e0c3923bbc28c92d0ecab4d50a3e
patch link: https://lore.kernel.org/r/20241216-of_core_fix-v2-6-e69b8f60da63%40quicinc.com
patch subject: [PATCH v2 6/7] of: Fix potential wrong MODALIAS uevent value
config: x86_64-buildonly-randconfig-001-20241216 (https://download.01.org/0day-ci/archive/20241216/202412161157.HWxjPpzy-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241216/202412161157.HWxjPpzy-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412161157.HWxjPpzy-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

In file included from include/linux/irqdomain.h:36,
from include/linux/i2c.h:21,
from drivers/leds/leds-blinkm.c:11:
include/linux/of.h: In function 'of_modalias':
>> include/linux/of.h:764:16: warning: returning 'int' from a function with return type 'char *' makes pointer from integer without a cast [-Wint-conversion]
764 | return -ENODEV;
| ^
--
In file included from include/linux/irqdomain.h:36,
from include/linux/gpio/driver.h:9,
from drivers/leds/leds-pca955x.c:44:
include/linux/of.h: In function 'of_modalias':
>> include/linux/of.h:764:16: warning: returning 'int' from a function with return type 'char *' makes pointer from integer without a cast [-Wint-conversion]
764 | return -ENODEV;
| ^
drivers/leds/leds-pca955x.c: In function 'pca955x_probe':
drivers/leds/leds-pca955x.c:555:43: warning: '%d' directive output may be truncated writing between 1 and 11 bytes into a region of size 8 [-Wformat-truncation=]
555 | "%d", i);
| ^~
drivers/leds/leds-pca955x.c:555:42: note: directive argument in the range [-2147483644, 2147483646]
555 | "%d", i);
| ^~~~
drivers/leds/leds-pca955x.c:554:33: note: 'snprintf' output between 2 and 12 bytes into a destination of size 8
554 | snprintf(default_label, sizeof(default_label),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
555 | "%d", i);
| ~~~~~~~~
--
In file included from drivers/leds/led-core.c:16:
include/linux/of.h: In function 'of_modalias':
>> include/linux/of.h:764:16: warning: returning 'int' from a function with return type 'char *' makes pointer from integer without a cast [-Wint-conversion]
764 | return -ENODEV;
| ^
drivers/leds/led-core.c: In function 'led_compose_name':
drivers/leds/led-core.c:551:78: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=]
551 | snprintf(led_classdev_name, LED_MAX_NAME_SIZE, "%s:%s",
| ^
drivers/leds/led-core.c:551:25: note: 'snprintf' output 2 or more bytes (assuming 65) into a destination of size 64
551 | snprintf(led_classdev_name, LED_MAX_NAME_SIZE, "%s:%s",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
552 | devicename, tmp_buf);
| ~~~~~~~~~~~~~~~~~~~~


vim +764 include/linux/of.h

bd69f73f2c81eed Grant Likely 2013-02-10 761
f1f6eae8bdfdfce Zijun Hu 2024-12-16 762 static inline char *of_modalias(const struct device_node *np, ssize_t *lenp)
bd7a7ed774afd1a Miquel Raynal 2023-04-04 763 {
bd7a7ed774afd1a Miquel Raynal 2023-04-04 @764 return -ENODEV;
bd7a7ed774afd1a Miquel Raynal 2023-04-04 765 }
bd7a7ed774afd1a Miquel Raynal 2023-04-04 766

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki