Re: [PATCH v2 net-next 5/5] ptp: clockmatrix: deprecate firmware older than 4.8.7

From: kernel test robot
Date: Tue Nov 17 2020 - 15:45:34 EST


Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]

url: https://github.com/0day-ci/linux/commits/min-li-xe-renesas-com/ptp_clockmatrix-bug-fix-and-improvement/20201118-004135
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 72308ecbf33b145641aba61071be31a85ebfd92c
config: sparc-allyesconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 9.3.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://github.com/0day-ci/linux/commit/2b6e446631ab9940f935bc0299d01cb323e35389
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review min-li-xe-renesas-com/ptp_clockmatrix-bug-fix-and-improvement/20201118-004135
git checkout 2b6e446631ab9940f935bc0299d01cb323e35389
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparc

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

All warnings (new ones prefixed by >>):

In function 'idtcm_strverscmp',
inlined from 'idtcm_set_version_info' at drivers/ptp/ptp_clockmatrix.c:2113:6,
inlined from 'idtcm_probe' at drivers/ptp/ptp_clockmatrix.c:2372:2:
>> drivers/ptp/ptp_clockmatrix.c:147:2: warning: 'strncpy' output may be truncated copying 15 bytes from a string of length 15 [-Wstringop-truncation]
147 | strncpy(ver1, version1, 15);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +/strncpy +147 drivers/ptp/ptp_clockmatrix.c

3a6ba7dc7799355 Vincent Cheng 2019-10-31 134
bdb09b91d9a2f66 Min Li 2020-11-17 135 static int idtcm_strverscmp(const char *version1, const char *version2)
7ea5fda2b1325e1 Min Li 2020-07-28 136 {
7ea5fda2b1325e1 Min Li 2020-07-28 137 u8 num1;
7ea5fda2b1325e1 Min Li 2020-07-28 138 u8 num2;
7ea5fda2b1325e1 Min Li 2020-07-28 139 int result = 0;
bdb09b91d9a2f66 Min Li 2020-11-17 140 char ver1[16];
bdb09b91d9a2f66 Min Li 2020-11-17 141 char ver2[16];
bdb09b91d9a2f66 Min Li 2020-11-17 142 char *cur1;
bdb09b91d9a2f66 Min Li 2020-11-17 143 char *cur2;
bdb09b91d9a2f66 Min Li 2020-11-17 144 char *next1;
bdb09b91d9a2f66 Min Li 2020-11-17 145 char *next2;
bdb09b91d9a2f66 Min Li 2020-11-17 146
bdb09b91d9a2f66 Min Li 2020-11-17 @147 strncpy(ver1, version1, 15);
bdb09b91d9a2f66 Min Li 2020-11-17 148 strncpy(ver2, version2, 15);
bdb09b91d9a2f66 Min Li 2020-11-17 149 cur1 = ver1;
bdb09b91d9a2f66 Min Li 2020-11-17 150 cur2 = ver2;
7ea5fda2b1325e1 Min Li 2020-07-28 151
7ea5fda2b1325e1 Min Li 2020-07-28 152 /* loop through each level of the version string */
7ea5fda2b1325e1 Min Li 2020-07-28 153 while (result == 0) {
bdb09b91d9a2f66 Min Li 2020-11-17 154 next1 = strchr(cur1, '.');
bdb09b91d9a2f66 Min Li 2020-11-17 155 next2 = strchr(cur2, '.');
bdb09b91d9a2f66 Min Li 2020-11-17 156
bdb09b91d9a2f66 Min Li 2020-11-17 157 /* kstrtou8 could fail for dot */
bdb09b91d9a2f66 Min Li 2020-11-17 158 if (next1) {
bdb09b91d9a2f66 Min Li 2020-11-17 159 *next1 = '\0';
bdb09b91d9a2f66 Min Li 2020-11-17 160 next1++;
bdb09b91d9a2f66 Min Li 2020-11-17 161 }
bdb09b91d9a2f66 Min Li 2020-11-17 162
bdb09b91d9a2f66 Min Li 2020-11-17 163 if (next2) {
bdb09b91d9a2f66 Min Li 2020-11-17 164 *next2 = '\0';
bdb09b91d9a2f66 Min Li 2020-11-17 165 next2++;
bdb09b91d9a2f66 Min Li 2020-11-17 166 }
bdb09b91d9a2f66 Min Li 2020-11-17 167
7ea5fda2b1325e1 Min Li 2020-07-28 168 /* extract leading version numbers */
bdb09b91d9a2f66 Min Li 2020-11-17 169 if (kstrtou8(cur1, 10, &num1) < 0)
7ea5fda2b1325e1 Min Li 2020-07-28 170 return -1;
7ea5fda2b1325e1 Min Li 2020-07-28 171
bdb09b91d9a2f66 Min Li 2020-11-17 172 if (kstrtou8(cur2, 10, &num2) < 0)
7ea5fda2b1325e1 Min Li 2020-07-28 173 return -1;
7ea5fda2b1325e1 Min Li 2020-07-28 174
7ea5fda2b1325e1 Min Li 2020-07-28 175 /* if numbers differ, then set the result */
bdb09b91d9a2f66 Min Li 2020-11-17 176 if (num1 < num2) {
7ea5fda2b1325e1 Min Li 2020-07-28 177 result = -1;
bdb09b91d9a2f66 Min Li 2020-11-17 178 } else if (num1 > num2) {
7ea5fda2b1325e1 Min Li 2020-07-28 179 result = 1;
bdb09b91d9a2f66 Min Li 2020-11-17 180 } else {
7ea5fda2b1325e1 Min Li 2020-07-28 181 /* if numbers are the same, go to next level */
bdb09b91d9a2f66 Min Li 2020-11-17 182 if (!next1 && !next2)
7ea5fda2b1325e1 Min Li 2020-07-28 183 break;
bdb09b91d9a2f66 Min Li 2020-11-17 184 else if (!next1) {
7ea5fda2b1325e1 Min Li 2020-07-28 185 result = -1;
bdb09b91d9a2f66 Min Li 2020-11-17 186 } else if (!next2) {
7ea5fda2b1325e1 Min Li 2020-07-28 187 result = 1;
bdb09b91d9a2f66 Min Li 2020-11-17 188 } else {
bdb09b91d9a2f66 Min Li 2020-11-17 189 cur1 = next1;
bdb09b91d9a2f66 Min Li 2020-11-17 190 cur2 = next2;
7ea5fda2b1325e1 Min Li 2020-07-28 191 }
7ea5fda2b1325e1 Min Li 2020-07-28 192 }
7ea5fda2b1325e1 Min Li 2020-07-28 193 }
bdb09b91d9a2f66 Min Li 2020-11-17 194
7ea5fda2b1325e1 Min Li 2020-07-28 195 return result;
7ea5fda2b1325e1 Min Li 2020-07-28 196 }
7ea5fda2b1325e1 Min Li 2020-07-28 197

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

Attachment: .config.gz
Description: application/gzip