* [PATCH v2] scsi: mpt3sas: clean up a couple sizeof() uses
@ 2019-07-26 6:52 Dan Carpenter
2019-07-26 9:57 ` Sreekanth Reddy
2019-07-30 19:57 ` Martin K. Petersen
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-07-26 6:52 UTC (permalink / raw)
To: kernel-janitors
There is a copy and paste bug here. It uses EVENT_TRIGGERS size instead
of SCSI_TRIGGERS size but fortunately both size are 84 bytes so it
doesn't affect runtime.
These days the prefered style is to just say sizeof(object) instead of
sizeof(type) so I have updated the function to the latest style as well.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: Update the style to the 21st Century
drivers/scsi/mpt3sas/mpt3sas_ctl.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
index d4ecfbbe738c..41c54d4c9451 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
@@ -3278,9 +3278,8 @@ diag_trigger_scsi_store(struct device *cdev,
ssize_t sz;
spin_lock_irqsave(&ioc->diag_trigger_lock, flags);
- sz = min(sizeof(struct SL_WH_SCSI_TRIGGERS_T), count);
- memset(&ioc->diag_trigger_scsi, 0,
- sizeof(struct SL_WH_EVENT_TRIGGERS_T));
+ sz = min(sizeof(ioc->diag_trigger_scsi), count);
+ memset(&ioc->diag_trigger_scsi, 0, sizeof(ioc->diag_trigger_scsi));
memcpy(&ioc->diag_trigger_scsi, buf, sz);
if (ioc->diag_trigger_scsi.ValidEntries > NUM_VALID_ENTRIES)
ioc->diag_trigger_scsi.ValidEntries = NUM_VALID_ENTRIES;
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] scsi: mpt3sas: clean up a couple sizeof() uses
2019-07-26 6:52 [PATCH v2] scsi: mpt3sas: clean up a couple sizeof() uses Dan Carpenter
@ 2019-07-26 9:57 ` Sreekanth Reddy
2019-07-30 19:57 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Sreekanth Reddy @ 2019-07-26 9:57 UTC (permalink / raw)
To: kernel-janitors
On Fri, Jul 26, 2019 at 12:22 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> There is a copy and paste bug here. It uses EVENT_TRIGGERS size instead
> of SCSI_TRIGGERS size but fortunately both size are 84 bytes so it
> doesn't affect runtime.
>
> These days the prefered style is to just say sizeof(object) instead of
> sizeof(type) so I have updated the function to the latest style as well.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
> ---
> v2: Update the style to the 21st Century
>
> drivers/scsi/mpt3sas/mpt3sas_ctl.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
> index d4ecfbbe738c..41c54d4c9451 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
> @@ -3278,9 +3278,8 @@ diag_trigger_scsi_store(struct device *cdev,
> ssize_t sz;
>
> spin_lock_irqsave(&ioc->diag_trigger_lock, flags);
> - sz = min(sizeof(struct SL_WH_SCSI_TRIGGERS_T), count);
> - memset(&ioc->diag_trigger_scsi, 0,
> - sizeof(struct SL_WH_EVENT_TRIGGERS_T));
> + sz = min(sizeof(ioc->diag_trigger_scsi), count);
> + memset(&ioc->diag_trigger_scsi, 0, sizeof(ioc->diag_trigger_scsi));
> memcpy(&ioc->diag_trigger_scsi, buf, sz);
> if (ioc->diag_trigger_scsi.ValidEntries > NUM_VALID_ENTRIES)
> ioc->diag_trigger_scsi.ValidEntries = NUM_VALID_ENTRIES;
> --
> 2.20.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] scsi: mpt3sas: clean up a couple sizeof() uses
2019-07-26 6:52 [PATCH v2] scsi: mpt3sas: clean up a couple sizeof() uses Dan Carpenter
2019-07-26 9:57 ` Sreekanth Reddy
@ 2019-07-30 19:57 ` Martin K. Petersen
1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2019-07-30 19:57 UTC (permalink / raw)
To: kernel-janitors
Dan,
> There is a copy and paste bug here. It uses EVENT_TRIGGERS size instead
> of SCSI_TRIGGERS size but fortunately both size are 84 bytes so it
> doesn't affect runtime.
>
> These days the prefered style is to just say sizeof(object) instead of
> sizeof(type) so I have updated the function to the latest style as well.
Applied to 5.4/scsi-queue. Thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-30 19:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-26 6:52 [PATCH v2] scsi: mpt3sas: clean up a couple sizeof() uses Dan Carpenter
2019-07-26 9:57 ` Sreekanth Reddy
2019-07-30 19:57 ` Martin K. Petersen
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.