lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202202240853.dYMh2vPi-lkp@intel.com>
Date:   Thu, 24 Feb 2022 08:46:11 +0800
From:   kernel test robot <lkp@...el.com>
To:     Hannes Reinecke <hare@...e.de>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [hare-scsi-devel:tls-upcall.v2 55/67] net/tls/tls_main.c:1062:26:
 warning: format '%lu' expects argument of type 'long unsigned int', but
 argument 5 has type 'size_t' {aka 'unsigned int'}

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git tls-upcall.v2
head:   ac729ea3c52bda460616c71d5f5fc47b2e64da6d
commit: a6fbc57802543bef21b5327858ef990508375b4c [55/67] net/tls: fixup tls identity matching
config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20220224/202202240853.dYMh2vPi-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git/commit/?id=a6fbc57802543bef21b5327858ef990508375b4c
        git remote add hare-scsi-devel https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
        git fetch --no-tags hare-scsi-devel tls-upcall.v2
        git checkout a6fbc57802543bef21b5327858ef990508375b4c
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash net/tls/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/kernel.h:20,
                    from include/linux/cpumask.h:10,
                    from include/linux/mm_types_task.h:14,
                    from include/linux/mm_types.h:5,
                    from include/linux/buildid.h:5,
                    from include/linux/module.h:14,
                    from net/tls/tls_main.c:34:
   net/tls/tls_main.c: In function 'tls_identity_match':
>> net/tls/tls_main.c:1062:26: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
    1062 |                 pr_debug("%s: non-matching src %s len %lu\n",
         |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:340:21: note: in definition of macro 'pr_fmt'
     340 | #define pr_fmt(fmt) fmt
         |                     ^~~
   include/linux/dynamic_debug.h:152:9: note: in expansion of macro '__dynamic_func_call'
     152 |         __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:162:9: note: in expansion of macro '_dynamic_func_call'
     162 |         _dynamic_func_call(fmt, __dynamic_pr_debug,             \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:574:9: note: in expansion of macro 'dynamic_pr_debug'
     574 |         dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~
   net/tls/tls_main.c:1062:17: note: in expansion of macro 'pr_debug'
    1062 |                 pr_debug("%s: non-matching src %s len %lu\n",
         |                 ^~~~~~~~
   net/tls/tls_main.c:1062:57: note: format string is defined here
    1062 |                 pr_debug("%s: non-matching src %s len %lu\n",
         |                                                       ~~^
         |                                                         |
         |                                                         long unsigned int
         |                                                       %u
   In file included from include/linux/kernel.h:20,
                    from include/linux/cpumask.h:10,
                    from include/linux/mm_types_task.h:14,
                    from include/linux/mm_types.h:5,
                    from include/linux/buildid.h:5,
                    from include/linux/module.h:14,
                    from net/tls/tls_main.c:34:
   net/tls/tls_main.c:1076:26: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
    1076 |                 pr_debug("%s: non-matching dst %s len %lu\n",
         |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:340:21: note: in definition of macro 'pr_fmt'
     340 | #define pr_fmt(fmt) fmt
         |                     ^~~
   include/linux/dynamic_debug.h:152:9: note: in expansion of macro '__dynamic_func_call'
     152 |         __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:162:9: note: in expansion of macro '_dynamic_func_call'
     162 |         _dynamic_func_call(fmt, __dynamic_pr_debug,             \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:574:9: note: in expansion of macro 'dynamic_pr_debug'
     574 |         dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~
   net/tls/tls_main.c:1076:17: note: in expansion of macro 'pr_debug'
    1076 |                 pr_debug("%s: non-matching dst %s len %lu\n",
         |                 ^~~~~~~~
   net/tls/tls_main.c:1076:57: note: format string is defined here
    1076 |                 pr_debug("%s: non-matching dst %s len %lu\n",
         |                                                       ~~^
         |                                                         |
         |                                                         long unsigned int
         |                                                       %u
   In file included from include/linux/kernel.h:20,
                    from include/linux/cpumask.h:10,
                    from include/linux/mm_types_task.h:14,
                    from include/linux/mm_types.h:5,
                    from include/linux/buildid.h:5,
                    from include/linux/module.h:14,
                    from net/tls/tls_main.c:34:
   net/tls/tls_main.c:1090:26: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
    1090 |                 pr_debug("%s: non-matching port %s len %lu\n",
         |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:340:21: note: in definition of macro 'pr_fmt'
     340 | #define pr_fmt(fmt) fmt
         |                     ^~~
   include/linux/dynamic_debug.h:152:9: note: in expansion of macro '__dynamic_func_call'
     152 |         __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:162:9: note: in expansion of macro '_dynamic_func_call'
     162 |         _dynamic_func_call(fmt, __dynamic_pr_debug,             \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/printk.h:574:9: note: in expansion of macro 'dynamic_pr_debug'
     574 |         dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~~
   net/tls/tls_main.c:1090:17: note: in expansion of macro 'pr_debug'
    1090 |                 pr_debug("%s: non-matching port %s len %lu\n",
         |                 ^~~~~~~~
   net/tls/tls_main.c:1090:58: note: format string is defined here
    1090 |                 pr_debug("%s: non-matching port %s len %lu\n",
         |                                                        ~~^
         |                                                          |
         |                                                          long unsigned int
         |                                                        %u
   In file included from include/linux/kernel.h:20,
                    from include/linux/cpumask.h:10,
                    from include/linux/mm_types_task.h:14,
                    from include/linux/mm_types.h:5,
                    from include/linux/buildid.h:5,
                    from include/linux/module.h:14,
                    from net/tls/tls_main.c:34:
   net/tls/tls_main.c:1105:18: warning: format '%lu' expects argument of type 'long unsigned int', but argument 6 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
    1105 |         pr_debug("%s: match '%s' '%s' len %lu\n",
         |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/printk.h:340:21: note: in definition of macro 'pr_fmt'
     340 | #define pr_fmt(fmt) fmt
         |                     ^~~
   include/linux/dynamic_debug.h:152:9: note: in expansion of macro '__dynamic_func_call'
     152 |         __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)


vim +1062 net/tls/tls_main.c

  1014	
  1015	static bool tls_identity_match(const struct key *key,
  1016				       const struct key_match_data *match_data)
  1017	{
  1018		const char *src = key->description;
  1019		const char *dst = NULL, *port = NULL, *id = NULL;
  1020		const char *match_src, *match_dst, *match_port, *match_id;
  1021		size_t src_len, dst_len, port_len, id_len;
  1022	
  1023		dst = strchr(src, ';');
  1024		id_len = strlen(src);
  1025		if (dst) {
  1026			src_len = dst - src;
  1027			if (!src_len)
  1028				src = NULL;
  1029			id_len -= src_len + 1;
  1030			dst++;
  1031			port = strchr(dst, ';');
  1032			if (port) {
  1033				dst_len = port - dst;
  1034				if (!dst_len)
  1035					dst = NULL;
  1036				id_len -= dst_len + 1;
  1037				port++;
  1038				id = strchr(port, ';');
  1039				if (id) {
  1040					port_len = id - port;
  1041					if (!port_len)
  1042						port = NULL;
  1043					id_len -= port_len + 1;
  1044					id++;
  1045				}
  1046			}
  1047		}
  1048		pr_debug("%s: src %s dst %s port %s\n", __func__, src, dst, port);
  1049		/* simple string-based IP address matching */
  1050		/* hare: convert to sockaddr matching */
  1051		match_src = match_data->raw_data;
  1052		match_dst = strchr(match_src, ';');
  1053		/* Parsing error */
  1054		if (!match_dst) {
  1055			pr_debug("%s: match dst missing\n", __func__);
  1056			return false;
  1057		}
  1058		match_dst++;
  1059		pr_debug("%s: match src %s\n", __func__, match_src);
  1060		if (src && (match_dst - match_src) > 0 &&
  1061		    memcmp(src, match_src, src_len)) {
> 1062			pr_debug("%s: non-matching src %s len %lu\n",
  1063				 __func__, src, src_len);
  1064				return false;
  1065		}
  1066	
  1067		match_port = strchr(match_dst, ';');
  1068		if (!match_port) {
  1069			pr_debug("%s: match port missing\n", __func__);
  1070			return false;
  1071		}
  1072		match_port++;
  1073		pr_debug("%s: match dst %s\n", __func__, match_dst);
  1074		if (dst && (match_port - match_dst) > 0 &&
  1075		    memcmp(dst, match_dst, dst_len)) {
  1076			pr_debug("%s: non-matching dst %s len %lu\n",
  1077				 __func__, dst, dst_len);
  1078			return false;
  1079		}
  1080	
  1081		match_id = strchr(match_port, ';');
  1082		if (!match_id) {
  1083			pr_debug("%s: match identity missing\n", __func__);
  1084			return false;
  1085		}
  1086		match_id++;
  1087		pr_debug("%s: match port %s\n", __func__, match_port);
  1088		if (port && (match_id - match_port) > 0 &&
  1089		    memcmp(port, match_port, port_len)) {
  1090			pr_debug("%s: non-matching port %s len %lu\n",
  1091				 __func__, port, port_len);
  1092			return false;
  1093		}
  1094	
  1095		/* No match ID specified: match agains all IDs */
  1096		if (!match_id || !strlen(match_id)) {
  1097			pr_debug("%s: match w/ no identity\n", __func__);
  1098			return true;
  1099		}
  1100		/* Match ID specified, but no key ID: no match */
  1101		if (!id) {
  1102			pr_debug("%s: no identity to match\n", __func__);
  1103			return false;
  1104		}
  1105		pr_debug("%s: match '%s' '%s' len %lu\n",
  1106			 __func__, match_id, id, id_len);
  1107		return !memcmp(id, match_id, id_len);
  1108	}
  1109	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ