[hare-scsi-devel:tls-upcall.v4 127/156] net/tls/tls_main.c:1062:20: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int')

From: kernel test robot
Date: Sun Mar 13 2022 - 10:15:05 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git tls-upcall.v4
head: d2416ecdb6b03fc2e4aa40b20cdf919322713224
commit: 97a450fed0d4ce4978d51685dcca85f9e8b71811 [127/156] net/tls: register '.tls' keyring
config: i386-randconfig-a015 (https://download.01.org/0day-ci/archive/20220313/202203132251.f1LqIqDZ-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 0467eb2cb7654c15ae366967ef35093c5724c416)
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=97a450fed0d4ce4978d51685dcca85f9e8b71811
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.v4
git checkout 97a450fed0d4ce4978d51685dcca85f9e8b71811
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash net/tls/

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

All warnings (new ones prefixed by >>):

>> net/tls/tls_main.c:1062:20: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
__func__, src, src_len);
^~~~~~~
include/linux/printk.h:580:38: note: expanded from macro 'pr_debug'
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
~~~ ^~~~~~~~~~~
include/linux/printk.h:132:17: note: expanded from macro 'no_printk'
printk(fmt, ##__VA_ARGS__); \
~~~ ^~~~~~~~~~~
include/linux/printk.h:450:60: note: expanded from macro 'printk'
#define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
~~~ ^~~~~~~~~~~
include/linux/printk.h:422:19: note: expanded from macro 'printk_index_wrap'
_p_func(_fmt, ##__VA_ARGS__); \
~~~~ ^~~~~~~~~~~
net/tls/tls_main.c:1076:20: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
__func__, dst, dst_len);
^~~~~~~
include/linux/printk.h:580:38: note: expanded from macro 'pr_debug'
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
~~~ ^~~~~~~~~~~
include/linux/printk.h:132:17: note: expanded from macro 'no_printk'
printk(fmt, ##__VA_ARGS__); \
~~~ ^~~~~~~~~~~
include/linux/printk.h:450:60: note: expanded from macro 'printk'
#define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
~~~ ^~~~~~~~~~~
include/linux/printk.h:422:19: note: expanded from macro 'printk_index_wrap'
_p_func(_fmt, ##__VA_ARGS__); \
~~~~ ^~~~~~~~~~~
net/tls/tls_main.c:1090:21: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
__func__, port, port_len);
^~~~~~~~
include/linux/printk.h:580:38: note: expanded from macro 'pr_debug'
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
~~~ ^~~~~~~~~~~
include/linux/printk.h:132:17: note: expanded from macro 'no_printk'
printk(fmt, ##__VA_ARGS__); \
~~~ ^~~~~~~~~~~
include/linux/printk.h:450:60: note: expanded from macro 'printk'
#define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
~~~ ^~~~~~~~~~~
include/linux/printk.h:422:19: note: expanded from macro 'printk_index_wrap'
_p_func(_fmt, ##__VA_ARGS__); \
~~~~ ^~~~~~~~~~~
net/tls/tls_main.c:1105:28: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat]
__func__, match_id, id, id_len);
^~~~~~
include/linux/printk.h:580:38: note: expanded from macro 'pr_debug'
no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
~~~ ^~~~~~~~~~~
include/linux/printk.h:132:17: note: expanded from macro 'no_printk'
printk(fmt, ##__VA_ARGS__); \
~~~ ^~~~~~~~~~~
include/linux/printk.h:450:60: note: expanded from macro 'printk'
#define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__)
~~~ ^~~~~~~~~~~
include/linux/printk.h:422:19: note: expanded from macro 'printk_index_wrap'
_p_func(_fmt, ##__VA_ARGS__); \
~~~~ ^~~~~~~~~~~
4 warnings generated.


vim +1062 net/tls/tls_main.c

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

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