* Re: [PATCH] scsi: libfc: Fix passing zero to 'PTR_ERR' warning
@ 2020-08-18 23:01 kernel test robot
0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2020-08-18 23:01 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 4554 bytes --]
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20200818114235.51052-1-yuehaibing@huawei.com>
References: <20200818114235.51052-1-yuehaibing@huawei.com>
TO: YueHaibing <yuehaibing@huawei.com>
TO: hare(a)suse.de
TO: jejb(a)linux.ibm.com
TO: martin.petersen(a)oracle.com
CC: linux-scsi(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org
CC: YueHaibing <yuehaibing@huawei.com>
Hi YueHaibing,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on scsi/for-next v5.9-rc1 next-20200818]
[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]
url: https://github.com/0day-ci/linux/commits/YueHaibing/scsi-libfc-Fix-passing-zero-to-PTR_ERR-warning/20200818-194521
base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
:::::: branch date: 11 hours ago
:::::: commit date: 11 hours ago
config: x86_64-randconfig-m001-20200818 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
drivers/scsi/libfc/fc_disc.c:371 fc_disc_gpn_ft_req() error: uninitialized symbol 'err'.
Old smatch warnings:
drivers/scsi/libfc/fc_disc.c:304 fc_disc_error() warn: passing zero to 'PTR_ERR'
# https://github.com/0day-ci/linux/commit/c22a185df6f9701ac244e7f2ec1ba38e27177aec
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review YueHaibing/scsi-libfc-Fix-passing-zero-to-PTR_ERR-warning/20200818-194521
git checkout c22a185df6f9701ac244e7f2ec1ba38e27177aec
vim +/err +371 drivers/scsi/libfc/fc_disc.c
42e9a92fe6a909 Robert Love 2008-12-09 337
42e9a92fe6a909 Robert Love 2008-12-09 338 /**
34f42a070fc98f Robert Love 2009-02-27 339 * fc_disc_gpn_ft_req() - Send Get Port Names by FC-4 type (GPN_FT) request
b1987c884585a6 Lee Jones 2020-07-07 340 * @disc: The discovery context
42e9a92fe6a909 Robert Love 2008-12-09 341 */
42e9a92fe6a909 Robert Love 2008-12-09 342 static void fc_disc_gpn_ft_req(struct fc_disc *disc)
42e9a92fe6a909 Robert Love 2008-12-09 343 {
42e9a92fe6a909 Robert Love 2008-12-09 344 struct fc_frame *fp;
0685230c59b548 Joe Eykholt 2010-07-20 345 struct fc_lport *lport = fc_disc_lport(disc);
c22a185df6f970 YueHaibing 2020-08-18 346 int err;
42e9a92fe6a909 Robert Love 2008-12-09 347
ee35624e1e4e4e Hannes Reinecke 2018-07-04 348 lockdep_assert_held(&disc->disc_mutex);
ee35624e1e4e4e Hannes Reinecke 2018-07-04 349
42e9a92fe6a909 Robert Love 2008-12-09 350 WARN_ON(!fc_lport_test_ready(lport));
42e9a92fe6a909 Robert Love 2008-12-09 351
42e9a92fe6a909 Robert Love 2008-12-09 352 disc->pending = 1;
42e9a92fe6a909 Robert Love 2008-12-09 353 disc->requested = 0;
42e9a92fe6a909 Robert Love 2008-12-09 354
42e9a92fe6a909 Robert Love 2008-12-09 355 disc->buf_len = 0;
42e9a92fe6a909 Robert Love 2008-12-09 356 disc->seq_count = 0;
42e9a92fe6a909 Robert Love 2008-12-09 357 fp = fc_frame_alloc(lport,
42e9a92fe6a909 Robert Love 2008-12-09 358 sizeof(struct fc_ct_hdr) +
42e9a92fe6a909 Robert Love 2008-12-09 359 sizeof(struct fc_ns_gid_ft));
c22a185df6f970 YueHaibing 2020-08-18 360 if (!fp) {
c22a185df6f970 YueHaibing 2020-08-18 361 err = -ENOMEM;
42e9a92fe6a909 Robert Love 2008-12-09 362 goto err;
c22a185df6f970 YueHaibing 2020-08-18 363 }
42e9a92fe6a909 Robert Love 2008-12-09 364
a46f327aa5caf2 Joe Eykholt 2009-08-25 365 if (lport->tt.elsct_send(lport, 0, fp,
42e9a92fe6a909 Robert Love 2008-12-09 366 FC_NS_GPN_FT,
42e9a92fe6a909 Robert Love 2008-12-09 367 fc_disc_gpn_ft_resp,
b94f8951bf2566 Joe Eykholt 2009-11-03 368 disc, 3 * lport->r_a_tov))
42e9a92fe6a909 Robert Love 2008-12-09 369 return;
42e9a92fe6a909 Robert Love 2008-12-09 370 err:
c22a185df6f970 YueHaibing 2020-08-18 @371 fc_disc_error(disc, ERR_PTR(err));
42e9a92fe6a909 Robert Love 2008-12-09 372 }
42e9a92fe6a909 Robert Love 2008-12-09 373
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29592 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] scsi: libfc: Fix passing zero to 'PTR_ERR' warning
@ 2020-08-18 11:42 YueHaibing
2020-08-18 16:24 ` kernel test robot
2020-08-21 12:23 ` Dan Carpenter
0 siblings, 2 replies; 7+ messages in thread
From: YueHaibing @ 2020-08-18 11:42 UTC (permalink / raw)
To: hare, jejb, martin.petersen; +Cc: linux-scsi, linux-kernel, YueHaibing
drivers/scsi/libfc/fc_disc.c:304
fc_disc_error() warn: passing zero to 'PTR_ERR'
fc_disc_error() expect a ERR_PTR pointer, so pass
ERR_PTR(err) to fix this.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/scsi/libfc/fc_disc.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
index d8cbc9c0e766..1077fcff4d50 100644
--- a/drivers/scsi/libfc/fc_disc.c
+++ b/drivers/scsi/libfc/fc_disc.c
@@ -343,6 +343,7 @@ static void fc_disc_gpn_ft_req(struct fc_disc *disc)
{
struct fc_frame *fp;
struct fc_lport *lport = fc_disc_lport(disc);
+ int err;
lockdep_assert_held(&disc->disc_mutex);
@@ -356,8 +357,10 @@ static void fc_disc_gpn_ft_req(struct fc_disc *disc)
fp = fc_frame_alloc(lport,
sizeof(struct fc_ct_hdr) +
sizeof(struct fc_ns_gid_ft));
- if (!fp)
+ if (!fp) {
+ err = -ENOMEM;
goto err;
+ }
if (lport->tt.elsct_send(lport, 0, fp,
FC_NS_GPN_FT,
@@ -365,7 +368,7 @@ static void fc_disc_gpn_ft_req(struct fc_disc *disc)
disc, 3 * lport->r_a_tov))
return;
err:
- fc_disc_error(disc, NULL);
+ fc_disc_error(disc, ERR_PTR(err));
}
/**
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] scsi: libfc: Fix passing zero to 'PTR_ERR' warning
2020-08-18 11:42 YueHaibing
@ 2020-08-18 16:24 ` kernel test robot
2020-08-21 12:23 ` Dan Carpenter
1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2020-08-18 16:24 UTC (permalink / raw)
To: YueHaibing, hare, jejb, martin.petersen
Cc: kbuild-all, clang-built-linux, linux-scsi, linux-kernel, YueHaibing
[-- Attachment #1: Type: text/plain, Size: 5080 bytes --]
Hi YueHaibing,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on scsi/for-next v5.9-rc1 next-20200818]
[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]
url: https://github.com/0day-ci/linux/commits/YueHaibing/scsi-libfc-Fix-passing-zero-to-PTR_ERR-warning/20200818-194521
base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-randconfig-a002-20200818 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 790878f291fa5dc58a1c560cb6cc76fd1bfd1c5a)
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
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/scsi/libfc/fc_disc.c:365:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (lport->tt.elsct_send(lport, 0, fp,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/libfc/fc_disc.c:371:30: note: uninitialized use occurs here
fc_disc_error(disc, ERR_PTR(err));
^~~
drivers/scsi/libfc/fc_disc.c:365:2: note: remove the 'if' if its condition is always true
if (lport->tt.elsct_send(lport, 0, fp,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/libfc/fc_disc.c:346:9: note: initialize the variable 'err' to silence this warning
int err;
^
= 0
1 warning generated.
# https://github.com/0day-ci/linux/commit/c22a185df6f9701ac244e7f2ec1ba38e27177aec
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review YueHaibing/scsi-libfc-Fix-passing-zero-to-PTR_ERR-warning/20200818-194521
git checkout c22a185df6f9701ac244e7f2ec1ba38e27177aec
vim +365 drivers/scsi/libfc/fc_disc.c
42e9a92fe6a909 Robert Love 2008-12-09 337
42e9a92fe6a909 Robert Love 2008-12-09 338 /**
34f42a070fc98f Robert Love 2009-02-27 339 * fc_disc_gpn_ft_req() - Send Get Port Names by FC-4 type (GPN_FT) request
b1987c884585a6 Lee Jones 2020-07-07 340 * @disc: The discovery context
42e9a92fe6a909 Robert Love 2008-12-09 341 */
42e9a92fe6a909 Robert Love 2008-12-09 342 static void fc_disc_gpn_ft_req(struct fc_disc *disc)
42e9a92fe6a909 Robert Love 2008-12-09 343 {
42e9a92fe6a909 Robert Love 2008-12-09 344 struct fc_frame *fp;
0685230c59b548 Joe Eykholt 2010-07-20 345 struct fc_lport *lport = fc_disc_lport(disc);
c22a185df6f970 YueHaibing 2020-08-18 346 int err;
42e9a92fe6a909 Robert Love 2008-12-09 347
ee35624e1e4e4e Hannes Reinecke 2018-07-04 348 lockdep_assert_held(&disc->disc_mutex);
ee35624e1e4e4e Hannes Reinecke 2018-07-04 349
42e9a92fe6a909 Robert Love 2008-12-09 350 WARN_ON(!fc_lport_test_ready(lport));
42e9a92fe6a909 Robert Love 2008-12-09 351
42e9a92fe6a909 Robert Love 2008-12-09 352 disc->pending = 1;
42e9a92fe6a909 Robert Love 2008-12-09 353 disc->requested = 0;
42e9a92fe6a909 Robert Love 2008-12-09 354
42e9a92fe6a909 Robert Love 2008-12-09 355 disc->buf_len = 0;
42e9a92fe6a909 Robert Love 2008-12-09 356 disc->seq_count = 0;
42e9a92fe6a909 Robert Love 2008-12-09 357 fp = fc_frame_alloc(lport,
42e9a92fe6a909 Robert Love 2008-12-09 358 sizeof(struct fc_ct_hdr) +
42e9a92fe6a909 Robert Love 2008-12-09 359 sizeof(struct fc_ns_gid_ft));
c22a185df6f970 YueHaibing 2020-08-18 360 if (!fp) {
c22a185df6f970 YueHaibing 2020-08-18 361 err = -ENOMEM;
42e9a92fe6a909 Robert Love 2008-12-09 362 goto err;
c22a185df6f970 YueHaibing 2020-08-18 363 }
42e9a92fe6a909 Robert Love 2008-12-09 364
a46f327aa5caf2 Joe Eykholt 2009-08-25 @365 if (lport->tt.elsct_send(lport, 0, fp,
42e9a92fe6a909 Robert Love 2008-12-09 366 FC_NS_GPN_FT,
42e9a92fe6a909 Robert Love 2008-12-09 367 fc_disc_gpn_ft_resp,
b94f8951bf2566 Joe Eykholt 2009-11-03 368 disc, 3 * lport->r_a_tov))
42e9a92fe6a909 Robert Love 2008-12-09 369 return;
42e9a92fe6a909 Robert Love 2008-12-09 370 err:
c22a185df6f970 YueHaibing 2020-08-18 371 fc_disc_error(disc, ERR_PTR(err));
42e9a92fe6a909 Robert Love 2008-12-09 372 }
42e9a92fe6a909 Robert Love 2008-12-09 373
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31386 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] scsi: libfc: Fix passing zero to 'PTR_ERR' warning
@ 2020-08-18 16:24 ` kernel test robot
0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2020-08-18 16:24 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 5171 bytes --]
Hi YueHaibing,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on scsi/for-next v5.9-rc1 next-20200818]
[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]
url: https://github.com/0day-ci/linux/commits/YueHaibing/scsi-libfc-Fix-passing-zero-to-PTR_ERR-warning/20200818-194521
base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-randconfig-a002-20200818 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 790878f291fa5dc58a1c560cb6cc76fd1bfd1c5a)
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
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/scsi/libfc/fc_disc.c:365:6: warning: variable 'err' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (lport->tt.elsct_send(lport, 0, fp,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/libfc/fc_disc.c:371:30: note: uninitialized use occurs here
fc_disc_error(disc, ERR_PTR(err));
^~~
drivers/scsi/libfc/fc_disc.c:365:2: note: remove the 'if' if its condition is always true
if (lport->tt.elsct_send(lport, 0, fp,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/libfc/fc_disc.c:346:9: note: initialize the variable 'err' to silence this warning
int err;
^
= 0
1 warning generated.
# https://github.com/0day-ci/linux/commit/c22a185df6f9701ac244e7f2ec1ba38e27177aec
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review YueHaibing/scsi-libfc-Fix-passing-zero-to-PTR_ERR-warning/20200818-194521
git checkout c22a185df6f9701ac244e7f2ec1ba38e27177aec
vim +365 drivers/scsi/libfc/fc_disc.c
42e9a92fe6a909 Robert Love 2008-12-09 337
42e9a92fe6a909 Robert Love 2008-12-09 338 /**
34f42a070fc98f Robert Love 2009-02-27 339 * fc_disc_gpn_ft_req() - Send Get Port Names by FC-4 type (GPN_FT) request
b1987c884585a6 Lee Jones 2020-07-07 340 * @disc: The discovery context
42e9a92fe6a909 Robert Love 2008-12-09 341 */
42e9a92fe6a909 Robert Love 2008-12-09 342 static void fc_disc_gpn_ft_req(struct fc_disc *disc)
42e9a92fe6a909 Robert Love 2008-12-09 343 {
42e9a92fe6a909 Robert Love 2008-12-09 344 struct fc_frame *fp;
0685230c59b548 Joe Eykholt 2010-07-20 345 struct fc_lport *lport = fc_disc_lport(disc);
c22a185df6f970 YueHaibing 2020-08-18 346 int err;
42e9a92fe6a909 Robert Love 2008-12-09 347
ee35624e1e4e4e Hannes Reinecke 2018-07-04 348 lockdep_assert_held(&disc->disc_mutex);
ee35624e1e4e4e Hannes Reinecke 2018-07-04 349
42e9a92fe6a909 Robert Love 2008-12-09 350 WARN_ON(!fc_lport_test_ready(lport));
42e9a92fe6a909 Robert Love 2008-12-09 351
42e9a92fe6a909 Robert Love 2008-12-09 352 disc->pending = 1;
42e9a92fe6a909 Robert Love 2008-12-09 353 disc->requested = 0;
42e9a92fe6a909 Robert Love 2008-12-09 354
42e9a92fe6a909 Robert Love 2008-12-09 355 disc->buf_len = 0;
42e9a92fe6a909 Robert Love 2008-12-09 356 disc->seq_count = 0;
42e9a92fe6a909 Robert Love 2008-12-09 357 fp = fc_frame_alloc(lport,
42e9a92fe6a909 Robert Love 2008-12-09 358 sizeof(struct fc_ct_hdr) +
42e9a92fe6a909 Robert Love 2008-12-09 359 sizeof(struct fc_ns_gid_ft));
c22a185df6f970 YueHaibing 2020-08-18 360 if (!fp) {
c22a185df6f970 YueHaibing 2020-08-18 361 err = -ENOMEM;
42e9a92fe6a909 Robert Love 2008-12-09 362 goto err;
c22a185df6f970 YueHaibing 2020-08-18 363 }
42e9a92fe6a909 Robert Love 2008-12-09 364
a46f327aa5caf2 Joe Eykholt 2009-08-25 @365 if (lport->tt.elsct_send(lport, 0, fp,
42e9a92fe6a909 Robert Love 2008-12-09 366 FC_NS_GPN_FT,
42e9a92fe6a909 Robert Love 2008-12-09 367 fc_disc_gpn_ft_resp,
b94f8951bf2566 Joe Eykholt 2009-11-03 368 disc, 3 * lport->r_a_tov))
42e9a92fe6a909 Robert Love 2008-12-09 369 return;
42e9a92fe6a909 Robert Love 2008-12-09 370 err:
c22a185df6f970 YueHaibing 2020-08-18 371 fc_disc_error(disc, ERR_PTR(err));
42e9a92fe6a909 Robert Love 2008-12-09 372 }
42e9a92fe6a909 Robert Love 2008-12-09 373
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31386 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] scsi: libfc: Fix passing zero to 'PTR_ERR' warning
2020-08-18 11:42 YueHaibing
2020-08-18 16:24 ` kernel test robot
@ 2020-08-21 12:23 ` Dan Carpenter
1 sibling, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2020-08-21 12:23 UTC (permalink / raw)
To: kbuild, YueHaibing, hare, jejb, martin.petersen
Cc: lkp, kbuild-all, linux-scsi, linux-kernel, YueHaibing
[-- Attachment #1: Type: text/plain, Size: 3703 bytes --]
Hi YueHaibing,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on scsi/for-next v5.9-rc1 next-20200818]
[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]
url: https://github.com/0day-ci/linux/commits/YueHaibing/scsi-libfc-Fix-passing-zero-to-PTR_ERR-warning/20200818-194521
base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-randconfig-m001-20200818 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
drivers/scsi/libfc/fc_disc.c:371 fc_disc_gpn_ft_req() error: uninitialized symbol 'err'.
# https://github.com/0day-ci/linux/commit/c22a185df6f9701ac244e7f2ec1ba38e27177aec
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review YueHaibing/scsi-libfc-Fix-passing-zero-to-PTR_ERR-warning/20200818-194521
git checkout c22a185df6f9701ac244e7f2ec1ba38e27177aec
vim +/err +371 drivers/scsi/libfc/fc_disc.c
42e9a92fe6a909 Robert Love 2008-12-09 342 static void fc_disc_gpn_ft_req(struct fc_disc *disc)
42e9a92fe6a909 Robert Love 2008-12-09 343 {
42e9a92fe6a909 Robert Love 2008-12-09 344 struct fc_frame *fp;
0685230c59b548 Joe Eykholt 2010-07-20 345 struct fc_lport *lport = fc_disc_lport(disc);
c22a185df6f970 YueHaibing 2020-08-18 346 int err;
42e9a92fe6a909 Robert Love 2008-12-09 347
ee35624e1e4e4e Hannes Reinecke 2018-07-04 348 lockdep_assert_held(&disc->disc_mutex);
ee35624e1e4e4e Hannes Reinecke 2018-07-04 349
42e9a92fe6a909 Robert Love 2008-12-09 350 WARN_ON(!fc_lport_test_ready(lport));
42e9a92fe6a909 Robert Love 2008-12-09 351
42e9a92fe6a909 Robert Love 2008-12-09 352 disc->pending = 1;
42e9a92fe6a909 Robert Love 2008-12-09 353 disc->requested = 0;
42e9a92fe6a909 Robert Love 2008-12-09 354
42e9a92fe6a909 Robert Love 2008-12-09 355 disc->buf_len = 0;
42e9a92fe6a909 Robert Love 2008-12-09 356 disc->seq_count = 0;
42e9a92fe6a909 Robert Love 2008-12-09 357 fp = fc_frame_alloc(lport,
42e9a92fe6a909 Robert Love 2008-12-09 358 sizeof(struct fc_ct_hdr) +
42e9a92fe6a909 Robert Love 2008-12-09 359 sizeof(struct fc_ns_gid_ft));
c22a185df6f970 YueHaibing 2020-08-18 360 if (!fp) {
c22a185df6f970 YueHaibing 2020-08-18 361 err = -ENOMEM;
42e9a92fe6a909 Robert Love 2008-12-09 362 goto err;
c22a185df6f970 YueHaibing 2020-08-18 363 }
42e9a92fe6a909 Robert Love 2008-12-09 364
a46f327aa5caf2 Joe Eykholt 2009-08-25 365 if (lport->tt.elsct_send(lport, 0, fp,
42e9a92fe6a909 Robert Love 2008-12-09 366 FC_NS_GPN_FT,
42e9a92fe6a909 Robert Love 2008-12-09 367 fc_disc_gpn_ft_resp,
b94f8951bf2566 Joe Eykholt 2009-11-03 368 disc, 3 * lport->r_a_tov))
42e9a92fe6a909 Robert Love 2008-12-09 369 return;
It's Reverse the Last Condition anti-pattern. It's a special subcase of
Success Handling anti-pattern. Ugh... Anyway if tt.elsct_send()
returns NULL then "err" isn't initialized.
42e9a92fe6a909 Robert Love 2008-12-09 370 err:
c22a185df6f970 YueHaibing 2020-08-18 @371 fc_disc_error(disc, ERR_PTR(err));
42e9a92fe6a909 Robert Love 2008-12-09 372 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29592 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] scsi: libfc: Fix passing zero to 'PTR_ERR' warning
@ 2020-08-21 12:23 ` Dan Carpenter
0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2020-08-21 12:23 UTC (permalink / raw)
To: kbuild-all
[-- Attachment #1: Type: text/plain, Size: 3773 bytes --]
Hi YueHaibing,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on scsi/for-next v5.9-rc1 next-20200818]
[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]
url: https://github.com/0day-ci/linux/commits/YueHaibing/scsi-libfc-Fix-passing-zero-to-PTR_ERR-warning/20200818-194521
base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-randconfig-m001-20200818 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
drivers/scsi/libfc/fc_disc.c:371 fc_disc_gpn_ft_req() error: uninitialized symbol 'err'.
# https://github.com/0day-ci/linux/commit/c22a185df6f9701ac244e7f2ec1ba38e27177aec
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review YueHaibing/scsi-libfc-Fix-passing-zero-to-PTR_ERR-warning/20200818-194521
git checkout c22a185df6f9701ac244e7f2ec1ba38e27177aec
vim +/err +371 drivers/scsi/libfc/fc_disc.c
42e9a92fe6a909 Robert Love 2008-12-09 342 static void fc_disc_gpn_ft_req(struct fc_disc *disc)
42e9a92fe6a909 Robert Love 2008-12-09 343 {
42e9a92fe6a909 Robert Love 2008-12-09 344 struct fc_frame *fp;
0685230c59b548 Joe Eykholt 2010-07-20 345 struct fc_lport *lport = fc_disc_lport(disc);
c22a185df6f970 YueHaibing 2020-08-18 346 int err;
42e9a92fe6a909 Robert Love 2008-12-09 347
ee35624e1e4e4e Hannes Reinecke 2018-07-04 348 lockdep_assert_held(&disc->disc_mutex);
ee35624e1e4e4e Hannes Reinecke 2018-07-04 349
42e9a92fe6a909 Robert Love 2008-12-09 350 WARN_ON(!fc_lport_test_ready(lport));
42e9a92fe6a909 Robert Love 2008-12-09 351
42e9a92fe6a909 Robert Love 2008-12-09 352 disc->pending = 1;
42e9a92fe6a909 Robert Love 2008-12-09 353 disc->requested = 0;
42e9a92fe6a909 Robert Love 2008-12-09 354
42e9a92fe6a909 Robert Love 2008-12-09 355 disc->buf_len = 0;
42e9a92fe6a909 Robert Love 2008-12-09 356 disc->seq_count = 0;
42e9a92fe6a909 Robert Love 2008-12-09 357 fp = fc_frame_alloc(lport,
42e9a92fe6a909 Robert Love 2008-12-09 358 sizeof(struct fc_ct_hdr) +
42e9a92fe6a909 Robert Love 2008-12-09 359 sizeof(struct fc_ns_gid_ft));
c22a185df6f970 YueHaibing 2020-08-18 360 if (!fp) {
c22a185df6f970 YueHaibing 2020-08-18 361 err = -ENOMEM;
42e9a92fe6a909 Robert Love 2008-12-09 362 goto err;
c22a185df6f970 YueHaibing 2020-08-18 363 }
42e9a92fe6a909 Robert Love 2008-12-09 364
a46f327aa5caf2 Joe Eykholt 2009-08-25 365 if (lport->tt.elsct_send(lport, 0, fp,
42e9a92fe6a909 Robert Love 2008-12-09 366 FC_NS_GPN_FT,
42e9a92fe6a909 Robert Love 2008-12-09 367 fc_disc_gpn_ft_resp,
b94f8951bf2566 Joe Eykholt 2009-11-03 368 disc, 3 * lport->r_a_tov))
42e9a92fe6a909 Robert Love 2008-12-09 369 return;
It's Reverse the Last Condition anti-pattern. It's a special subcase of
Success Handling anti-pattern. Ugh... Anyway if tt.elsct_send()
returns NULL then "err" isn't initialized.
42e9a92fe6a909 Robert Love 2008-12-09 370 err:
c22a185df6f970 YueHaibing 2020-08-18 @371 fc_disc_error(disc, ERR_PTR(err));
42e9a92fe6a909 Robert Love 2008-12-09 372 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29592 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] scsi: libfc: Fix passing zero to 'PTR_ERR' warning
@ 2020-08-21 12:23 ` Dan Carpenter
0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2020-08-21 12:23 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 3773 bytes --]
Hi YueHaibing,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on mkp-scsi/for-next]
[also build test WARNING on scsi/for-next v5.9-rc1 next-20200818]
[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]
url: https://github.com/0day-ci/linux/commits/YueHaibing/scsi-libfc-Fix-passing-zero-to-PTR_ERR-warning/20200818-194521
base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: x86_64-randconfig-m001-20200818 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
New smatch warnings:
drivers/scsi/libfc/fc_disc.c:371 fc_disc_gpn_ft_req() error: uninitialized symbol 'err'.
# https://github.com/0day-ci/linux/commit/c22a185df6f9701ac244e7f2ec1ba38e27177aec
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review YueHaibing/scsi-libfc-Fix-passing-zero-to-PTR_ERR-warning/20200818-194521
git checkout c22a185df6f9701ac244e7f2ec1ba38e27177aec
vim +/err +371 drivers/scsi/libfc/fc_disc.c
42e9a92fe6a909 Robert Love 2008-12-09 342 static void fc_disc_gpn_ft_req(struct fc_disc *disc)
42e9a92fe6a909 Robert Love 2008-12-09 343 {
42e9a92fe6a909 Robert Love 2008-12-09 344 struct fc_frame *fp;
0685230c59b548 Joe Eykholt 2010-07-20 345 struct fc_lport *lport = fc_disc_lport(disc);
c22a185df6f970 YueHaibing 2020-08-18 346 int err;
42e9a92fe6a909 Robert Love 2008-12-09 347
ee35624e1e4e4e Hannes Reinecke 2018-07-04 348 lockdep_assert_held(&disc->disc_mutex);
ee35624e1e4e4e Hannes Reinecke 2018-07-04 349
42e9a92fe6a909 Robert Love 2008-12-09 350 WARN_ON(!fc_lport_test_ready(lport));
42e9a92fe6a909 Robert Love 2008-12-09 351
42e9a92fe6a909 Robert Love 2008-12-09 352 disc->pending = 1;
42e9a92fe6a909 Robert Love 2008-12-09 353 disc->requested = 0;
42e9a92fe6a909 Robert Love 2008-12-09 354
42e9a92fe6a909 Robert Love 2008-12-09 355 disc->buf_len = 0;
42e9a92fe6a909 Robert Love 2008-12-09 356 disc->seq_count = 0;
42e9a92fe6a909 Robert Love 2008-12-09 357 fp = fc_frame_alloc(lport,
42e9a92fe6a909 Robert Love 2008-12-09 358 sizeof(struct fc_ct_hdr) +
42e9a92fe6a909 Robert Love 2008-12-09 359 sizeof(struct fc_ns_gid_ft));
c22a185df6f970 YueHaibing 2020-08-18 360 if (!fp) {
c22a185df6f970 YueHaibing 2020-08-18 361 err = -ENOMEM;
42e9a92fe6a909 Robert Love 2008-12-09 362 goto err;
c22a185df6f970 YueHaibing 2020-08-18 363 }
42e9a92fe6a909 Robert Love 2008-12-09 364
a46f327aa5caf2 Joe Eykholt 2009-08-25 365 if (lport->tt.elsct_send(lport, 0, fp,
42e9a92fe6a909 Robert Love 2008-12-09 366 FC_NS_GPN_FT,
42e9a92fe6a909 Robert Love 2008-12-09 367 fc_disc_gpn_ft_resp,
b94f8951bf2566 Joe Eykholt 2009-11-03 368 disc, 3 * lport->r_a_tov))
42e9a92fe6a909 Robert Love 2008-12-09 369 return;
It's Reverse the Last Condition anti-pattern. It's a special subcase of
Success Handling anti-pattern. Ugh... Anyway if tt.elsct_send()
returns NULL then "err" isn't initialized.
42e9a92fe6a909 Robert Love 2008-12-09 370 err:
c22a185df6f970 YueHaibing 2020-08-18 @371 fc_disc_error(disc, ERR_PTR(err));
42e9a92fe6a909 Robert Love 2008-12-09 372 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 29592 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-08-21 12:24 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18 23:01 [PATCH] scsi: libfc: Fix passing zero to 'PTR_ERR' warning kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2020-08-18 11:42 YueHaibing
2020-08-18 16:24 ` kernel test robot
2020-08-18 16:24 ` kernel test robot
2020-08-21 12:23 ` Dan Carpenter
2020-08-21 12:23 ` Dan Carpenter
2020-08-21 12:23 ` Dan Carpenter
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.