Obviously, this isn't a bug. This warning message is printed using a two step process. The first step makes a list of functions where one parameter is the buffer and one parameter is the size. The second step prints a warning if we call one of those functions with a buffer which is smaller than the size.
This test is useful for copy_to_user() or something like that where reading beyond the end of the array is a security problem. Often when people call strncmp() with a string literal, it means that they haven't thought very hard about how strcmp() and strncmp() work. In this case though the string literal is a define so using strncmp() makes sense, I suppose. It's unlikely that using strncmp() with a larger than possible limit will cause a bug so I will add strncmp() to the list of ignored functions smatch_data/kernel.sizeof_param.remove regards, dan carpenter --------------------- Hi Zhang, FYI, there are new smatch warnings show up in tree: git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git next head: e79ca84d62d289b90cb39c80df83acf9f315a25c commit: 635a1f41a8f95a35d1bf24c9cc018ffb018a93e6 [2/11] Thermal: thermal zone governor fix drivers/thermal/thermal_core.c:90 thermal_register_governor() error: strncmp() '"step_wise"' too small (10 vs 20) git remote add thermal git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git git remote update thermal git checkout 635a1f41a8f95a35d1bf24c9cc018ffb018a93e6 vim +90 drivers/thermal/thermal_core.c a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 74 a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 75 int thermal_register_governor(struct thermal_governor *governor) a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 76 { a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 77 int err; a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 78 const char *name; a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 79 struct thermal_zone_device *pos; a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 80 a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 81 if (!governor) a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 82 return -EINVAL; a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 83 a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 84 mutex_lock(&thermal_governor_lock); a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 85 a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 86 err = -EBUSY; a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 87 if (__find_governor(governor->name) == NULL) { a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 88 err = 0; a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 89 list_add(&governor->governor_list, &thermal_governor_list); 635a1f41a drivers/thermal/thermal_core.c Zhang Rui 2014-01-24 @90 if (!def_governor && !strncmp(governor->name, 635a1f41a drivers/thermal/thermal_core.c Zhang Rui 2014-01-24 91 DEFAULT_THERMAL_GOVERNOR, THERMAL_NAME_LENGTH)) 635a1f41a drivers/thermal/thermal_core.c Zhang Rui 2014-01-24 92 def_governor = governor; a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 93 } a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 94 a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 95 mutex_lock(&thermal_list_lock); a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 96 a4a15485f drivers/thermal/thermal_sys.c Durgadoss R 2012-09-18 97 list_for_each_entry(pos, &thermal_tz_list, node) { 635a1f41a drivers/thermal/thermal_core.c Zhang Rui 2014-01-24 98 /* --- 0-DAY kernel build testing backend Open Source Technology Center http://lists.01.org/mailman/listinfo/kbuild Intel Corporation _______________________________________________ kbuild mailing list kbuild@lists.01.org https://lists.01.org/mailman/listinfo/kbuild