Re: [PATCH v4 3/5] string: add strends() helper to check if a string ends with a suffix

kernel test robot
2024-10-01T14:34:27Z

Hi Christian,

kernel test robot noticed the following build errors:

[auto build test ERROR on axboe-block/for-next]
[also build test ERROR on kees/for-next/hardening robh/for-next lwn/docs-next linus/master v6.12-rc1 next-20241001]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Christian-Marangi/block-add-support-for-defining-read-only-partitions/20240930-193609
base: https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux-block.git for-next
patch link: https://lore.kernel.org/r/20240930113045.28616-4-ansuelsmth%40gmail.com
patch subject: [PATCH v4 3/5] string: add strends() helper to check if a string ends with a suffix
config: s390-randconfig-001-20241001 (https://download.01.org/0day-ci/archive/20241001/202410012202.g0GogVZR-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241001/202410012202.g0GogVZR-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410012202.g0GogVZR-lkp@intel.com/

All errors (new ones prefixed by >>):

In file included from arch/s390/purgatory/../lib/string.c:16,
from arch/s390/purgatory/string.c:3:
include/linux/string.h: In function 'strends':
>> include/linux/string.h:366:27: error: implicit declaration of function 'memcmp' [-Wimplicit-function-declaration]
366 | return n >= m && !memcmp(str + n - m, suffix, m);
| ^~~~~~
include/linux/string.h:65:1: note: 'memcmp' is defined in header '<string.h>'; this is probably fixable by adding '#include <string.h>'
64 | #include <asm/string.h>
+++ |+#include <string.h>
65 |

vim +/memcmp +366 include/linux/string.h

355
356 /**
357 * strends - does @str end with @suffix?
358 * @str: string to examine
359 * @suffix: suffix to look for.
360 */
361 static inline bool strends(const char *str, const char *suffix)
362 {
363 size_t n = strlen(str);
364 size_t m = strlen(suffix);
365
> 366 return n >= m && !memcmp(str + n - m, suffix, m);
367 }
368

--
0-DAY CI Kernel Test Service