* [jlawall:for-5.12 1/6] drivers/scsi/hpsa.c:2668:28-29: WARNING opportunity for min()
@ 2021-05-02 1:01 kernel test robot
2021-05-02 1:01 ` [PATCH] coccinelle: misc: fix minmax.cocci warnings kernel test robot
2021-05-02 1:01 ` kernel test robot
0 siblings, 2 replies; 3+ messages in thread
From: kernel test robot @ 2021-05-02 1:01 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 1095 bytes --]
CC: kbuild-all(a)lists.01.org
TO: Denis Efremov <efremov@linux.com>
CC: Julia Lawall <Julia.Lawall@inria.fr>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux.git for-5.12
head: afa104b04309a6e882f6797216e74489c0d5534f
commit: 8636e3295ce33515c50ef728f0ff3800d97f9f44 [1/6] coccinelle: misc: add minmax script
:::::: branch date: 4 days ago
:::::: commit date: 6 weeks ago
config: riscv-allyesconfig (attached as .config)
compiler: riscv64-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
cocci warnings: (new ones prefixed by >>)
>> drivers/scsi/hpsa.c:2668:28-29: WARNING opportunity for min()
drivers/scsi/hpsa.c:3634:34-36: WARNING opportunity for min()
--
>> drivers/message/fusion/mptctl.c:1618:29-30: WARNING opportunity for min()
Please review and possibly fold the followup patch.
---
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: 68967 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] coccinelle: misc: fix minmax.cocci warnings
2021-05-02 1:01 [jlawall:for-5.12 1/6] drivers/scsi/hpsa.c:2668:28-29: WARNING opportunity for min() kernel test robot
@ 2021-05-02 1:01 ` kernel test robot
2021-05-02 1:01 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-05-02 1:01 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 2393 bytes --]
CC: kbuild-all(a)lists.01.org
TO: Denis Efremov <efremov@linux.com>
CC: Julia Lawall <Julia.Lawall@inria.fr>
CC: Don Brace <don.brace@microchip.com>
CC: "James E.J. Bottomley" <jejb@linux.ibm.com>
CC: "Martin K. Petersen" <martin.petersen@oracle.com>
CC: storagedev(a)microchip.com
CC: linux-scsi(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org
From: kernel test robot <lkp@intel.com>
drivers/scsi/hpsa.c:2668:28-29: WARNING opportunity for min()
drivers/scsi/hpsa.c:3634:34-36: WARNING opportunity for min()
Check for opencoded min(), max() implementations.
Generated patches sometimes require adding a cast to fix compile warning.
Warnings/patches scope intentionally limited to a function body.
Generated by: scripts/coccinelle/misc/minmax.cocci
Fixes: 8636e3295ce3 ("coccinelle: misc: add minmax script")
CC: Denis Efremov <efremov@linux.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux.git for-5.12
head: afa104b04309a6e882f6797216e74489c0d5534f
commit: 8636e3295ce33515c50ef728f0ff3800d97f9f44 [1/6] coccinelle: misc: add minmax script
:::::: branch date: 4 days ago
:::::: commit date: 6 weeks ago
Please take the patch only if it's a positive warning. Thanks!
hpsa.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -2665,10 +2665,8 @@ static void complete_scsi_command(struct
case CMD_TARGET_STATUS:
cmd->result |= ei->ScsiStatus;
/* copy the sense data */
- if (SCSI_SENSE_BUFFERSIZE < sizeof(ei->SenseInfo))
- sense_data_size = SCSI_SENSE_BUFFERSIZE;
- else
- sense_data_size = sizeof(ei->SenseInfo);
+ sense_data_size = min(SCSI_SENSE_BUFFERSIZE,
+ sizeof(ei->SenseInfo));
if (ei->SenseLen < sense_data_size)
sense_data_size = ei->SenseLen;
memcpy(cmd->sense_buffer, ei->SenseInfo, sense_data_size);
@@ -3631,10 +3629,7 @@ static bool hpsa_vpd_page_supported(stru
if (rc != 0)
goto exit_unsupported;
pages = buf[3];
- if ((pages + HPSA_VPD_HEADER_SZ) <= 255)
- bufsize = pages + HPSA_VPD_HEADER_SZ;
- else
- bufsize = 255;
+ bufsize = min(pages + HPSA_VPD_HEADER_SZ, 255);
/* Get the whole VPD page list */
rc = hpsa_scsi_do_inquiry(h, scsi3addr,
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH] coccinelle: misc: fix minmax.cocci warnings
2021-05-02 1:01 [jlawall:for-5.12 1/6] drivers/scsi/hpsa.c:2668:28-29: WARNING opportunity for min() kernel test robot
2021-05-02 1:01 ` [PATCH] coccinelle: misc: fix minmax.cocci warnings kernel test robot
@ 2021-05-02 1:01 ` kernel test robot
1 sibling, 0 replies; 3+ messages in thread
From: kernel test robot @ 2021-05-02 1:01 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 1820 bytes --]
CC: kbuild-all(a)lists.01.org
TO: Denis Efremov <efremov@linux.com>
CC: Julia Lawall <Julia.Lawall@inria.fr>
CC: Sathya Prakash <sathya.prakash@broadcom.com>
CC: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
CC: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
CC: MPT-FusionLinux.pdl(a)broadcom.com
CC: linux-scsi(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org
From: kernel test robot <lkp@intel.com>
drivers/message/fusion/mptctl.c:1618:29-30: WARNING opportunity for min()
Check for opencoded min(), max() implementations.
Generated patches sometimes require adding a cast to fix compile warning.
Warnings/patches scope intentionally limited to a function body.
Generated by: scripts/coccinelle/misc/minmax.cocci
Fixes: 8636e3295ce3 ("coccinelle: misc: add minmax script")
CC: Denis Efremov <efremov@linux.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---
tree: https://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux.git for-5.12
head: afa104b04309a6e882f6797216e74489c0d5534f
commit: 8636e3295ce33515c50ef728f0ff3800d97f9f44 [1/6] coccinelle: misc: add minmax script
:::::: branch date: 4 days ago
:::::: commit date: 6 weeks ago
Please take the patch only if it's a positive warning. Thanks!
mptctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/message/fusion/mptctl.c
+++ b/drivers/message/fusion/mptctl.c
@@ -1615,7 +1615,7 @@ mptctl_eventreport (MPT_ADAPTER *ioc, un
maxEvents = numBytes/sizeof(MPT_IOCTL_EVENTS);
- max = MPTCTL_EVENT_LOG_SIZE < maxEvents ? MPTCTL_EVENT_LOG_SIZE : maxEvents;
+ max = min(MPTCTL_EVENT_LOG_SIZE, maxEvents);
/* If fewer than 1 event is requested, there must have
* been some type of error.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-02 1:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-02 1:01 [jlawall:for-5.12 1/6] drivers/scsi/hpsa.c:2668:28-29: WARNING opportunity for min() kernel test robot
2021-05-02 1:01 ` [PATCH] coccinelle: misc: fix minmax.cocci warnings kernel test robot
2021-05-02 1:01 ` kernel test robot
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.