[staging:staging-next 446/587] drivers/staging/lustre/lnet/lnet/lib-socket.c:212:16-19: ERROR: reference preceded by free on line 198 (fwd)
Julia Lawall
julia.lawall at lip6.fr
Sat Jan 27 13:37:49 UTC 2018
Please check whether line 212 is reachable from line 198.
julia
---------- Forwarded message ----------
Date: Sat, 27 Jan 2018 16:00:47 +0800
From: kbuild test robot <fengguang.wu at intel.com>
To: kbuild at 01.org
Cc: Julia Lawall <julia.lawall at lip6.fr>
Subject: [staging:staging-next 446/587]
drivers/staging/lustre/lnet/lnet/lib-socket.c:212:16-19: ERROR: reference
preceded by free on line 198
tree: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git staging-next
head: 3384e01179eff2b2fe91ba7bcad98ee2be5f87f7
commit: 464dbfcaa2d581c6bc03e87c73af1dc403336b85 [446/587] staging: lustre: more LIBCFS_ALLOC conversions to GFP_KERNEL allocations.
:::::: branch date: 18 hours ago
:::::: commit date: 3 weeks ago
>> drivers/staging/lustre/lnet/lnet/lib-socket.c:212:16-19: ERROR: reference preceded by free on line 198
drivers/staging/lustre/lnet/lnet/lib-socket.c:238:7-10: ERROR: reference preceded by free on line 198
--
>> drivers/staging/lustre/lnet/selftest/conctl.c:651:10-17: WARNING opportunity for memdup_user
drivers/staging/lustre/lnet/selftest/conctl.c:704:7-14: WARNING opportunity for memdup_user
# https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/commit/?id=464dbfcaa2d581c6bc03e87c73af1dc403336b85
git remote add staging https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
git remote update staging
git checkout 464dbfcaa2d581c6bc03e87c73af1dc403336b85
vim +212 drivers/staging/lustre/lnet/lnet/lib-socket.c
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 148
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 149 int
1ad6a73ef drivers/staging/lustre/lnet/lnet/lib-socket.c James Simmons 2015-06-08 150 lnet_ipif_enumerate(char ***namesp)
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 151 {
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 152 /* Allocate and fill in 'names', returning # interfaces/error */
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 153 char **names;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 154 int toobig;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 155 int nalloc;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 156 int nfound;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 157 struct ifreq *ifr;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 158 struct ifconf ifc;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 159 int rc;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 160 int nob;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 161 int i;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 162
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 163 nalloc = 16; /* first guess at max interfaces */
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 164 toobig = 0;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 165 for (;;) {
09cbfeaf1 drivers/staging/lustre/lnet/lnet/lib-socket.c Kirill A. Shutemov 2016-04-01 166 if (nalloc * sizeof(*ifr) > PAGE_SIZE) {
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 167 toobig = 1;
09cbfeaf1 drivers/staging/lustre/lnet/lnet/lib-socket.c Kirill A. Shutemov 2016-04-01 168 nalloc = PAGE_SIZE / sizeof(*ifr);
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 169 CWARN("Too many interfaces: only enumerating first %d\n",
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 170 nalloc);
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 171 }
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 172
464dbfcaa drivers/staging/lustre/lnet/lnet/lib-socket.c NeilBrown 2018-01-09 173 ifr = kzalloc(nalloc * sizeof(*ifr), GFP_KERNEL);
06ace26ed drivers/staging/lustre/lnet/lnet/lib-socket.c James Simmons 2016-02-12 174 if (!ifr) {
730928920 drivers/staging/lustre/lnet/lnet/lib-socket.c James Simmons 2015-06-08 175 CERROR("ENOMEM enumerating up to %d interfaces\n",
730928920 drivers/staging/lustre/lnet/lnet/lib-socket.c James Simmons 2015-06-08 176 nalloc);
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 177 rc = -ENOMEM;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 178 goto out0;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 179 }
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 180
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 181 ifc.ifc_buf = (char *)ifr;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 182 ifc.ifc_len = nalloc * sizeof(*ifr);
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 183
1ad6a73ef drivers/staging/lustre/lnet/lnet/lib-socket.c James Simmons 2015-06-08 184 rc = lnet_sock_ioctl(SIOCGIFCONF, (unsigned long)&ifc);
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 185 if (rc < 0) {
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 186 CERROR("Error %d enumerating interfaces\n", rc);
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 187 goto out1;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 188 }
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 189
5fd88337d drivers/staging/lustre/lnet/lnet/lib-socket.c James Simmons 2016-02-12 190 LASSERT(!rc);
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 191
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 192 nfound = ifc.ifc_len / sizeof(*ifr);
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 193 LASSERT(nfound <= nalloc);
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 194
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 195 if (nfound < nalloc || toobig)
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 196 break;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 197
464dbfcaa drivers/staging/lustre/lnet/lnet/lib-socket.c NeilBrown 2018-01-09 @198 kfree(ifr);
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 199 nalloc *= 2;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 200 }
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 201
5fd88337d drivers/staging/lustre/lnet/lnet/lib-socket.c James Simmons 2016-02-12 202 if (!nfound)
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 203 goto out1;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 204
464dbfcaa drivers/staging/lustre/lnet/lnet/lib-socket.c NeilBrown 2018-01-09 205 names = kzalloc(nfound * sizeof(*names), GFP_KERNEL);
06ace26ed drivers/staging/lustre/lnet/lnet/lib-socket.c James Simmons 2016-02-12 206 if (!names) {
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 207 rc = -ENOMEM;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 208 goto out1;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 209 }
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 210
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 211 for (i = 0; i < nfound; i++) {
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 @212 nob = strnlen(ifr[i].ifr_name, IFNAMSIZ);
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 213 if (nob == IFNAMSIZ) {
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 214 /* no space for terminating NULL */
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 215 CERROR("interface name %.*s too long (%d max)\n",
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 216 nob, ifr[i].ifr_name, IFNAMSIZ);
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 217 rc = -ENAMETOOLONG;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 218 goto out2;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 219 }
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 220
464dbfcaa drivers/staging/lustre/lnet/lnet/lib-socket.c NeilBrown 2018-01-09 221 names[i] = kmalloc(IFNAMSIZ, GFP_KERNEL);
06ace26ed drivers/staging/lustre/lnet/lnet/lib-socket.c James Simmons 2016-02-12 222 if (!names[i]) {
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 223 rc = -ENOMEM;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 224 goto out2;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 225 }
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 226
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 227 memcpy(names[i], ifr[i].ifr_name, nob);
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 228 names[i][nob] = 0;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 229 }
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 230
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 231 *namesp = names;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 232 rc = nfound;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 233
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 234 out2:
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 235 if (rc < 0)
1ad6a73ef drivers/staging/lustre/lnet/lnet/lib-socket.c James Simmons 2015-06-08 236 lnet_ipif_free_enumeration(names, nfound);
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 237 out1:
464dbfcaa drivers/staging/lustre/lnet/lnet/lib-socket.c NeilBrown 2018-01-09 238 kfree(ifr);
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 239 out0:
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 240 return rc;
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 241 }
1ad6a73ef drivers/staging/lustre/lnet/lnet/lib-socket.c James Simmons 2015-06-08 242 EXPORT_SYMBOL(lnet_ipif_enumerate);
d7e09d039 drivers/staging/lustre/lustre/libcfs/linux/linux-tcpip.c Peng Tao 2013-05-02 243
:::::: The code at line 212 was first introduced by commit
:::::: d7e09d0397e84eefbabfd9cb353221f3c6448d83 staging: add Lustre file system client support
:::::: TO: Peng Tao <bergwolf at gmail.com>
:::::: CC: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
More information about the devel
mailing list