mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scsi: pm8001: Fix error code in non_fatal_log_show()
@ 2026-05-30 19:45 Dan Carpenter
  2026-06-01  4:59 ` Jinpu Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Carpenter @ 2026-05-30 19:45 UTC (permalink / raw)
  To: Deepak Ukey
  Cc: Jack Wang, James E.J. Bottomley, Martin K. Petersen,
	Radha Ramachandran, Viswas G, linux-scsi, linux-kernel,
	kernel-janitors

The non_fatal_log_show() function is supposed to return negative
error codes on failure.  But because the error codes are saved in
a u32 and then cast to signed long, they end up being high positive
values instead of negative.  Remove the intermediary u32 variable
to fix this bug.

Fixes: dba2cc03b9db ("scsi: pm80xx: sysfs attribute for non fatal dump")
Signed-off-by: Dan Carpenter <error27@gmail.com>
---
 drivers/scsi/pm8001/pm8001_ctl.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c
index bb38b2d63acb..a27f3287748e 100644
--- a/drivers/scsi/pm8001/pm8001_ctl.c
+++ b/drivers/scsi/pm8001/pm8001_ctl.c
@@ -588,10 +588,7 @@ static DEVICE_ATTR(fatal_log, S_IRUGO, pm8001_ctl_fatal_log_show, NULL);
 static ssize_t non_fatal_log_show(struct device *cdev,
 	struct device_attribute *attr, char *buf)
 {
-	u32 count;
-
-	count = pm80xx_get_non_fatal_dump(cdev, attr, buf);
-	return count;
+	return pm80xx_get_non_fatal_dump(cdev, attr, buf);
 }
 static DEVICE_ATTR_RO(non_fatal_log);
 
-- 
2.53.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: pm8001: Fix error code in non_fatal_log_show()
  2026-05-30 19:45 [PATCH] scsi: pm8001: Fix error code in non_fatal_log_show() Dan Carpenter
@ 2026-06-01  4:59 ` Jinpu Wang
  2026-06-02  1:52 ` Martin K. Petersen
  2026-06-09  1:39 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Jinpu Wang @ 2026-06-01  4:59 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Deepak Ukey, James E.J. Bottomley, Martin K. Petersen,
	Radha Ramachandran, Viswas G, linux-scsi, linux-kernel,
	kernel-janitors

On Sat, May 30, 2026 at 9:45 PM Dan Carpenter <error27@gmail.com> wrote:
>
> The non_fatal_log_show() function is supposed to return negative
> error codes on failure.  But because the error codes are saved in
> a u32 and then cast to signed long, they end up being high positive
> values instead of negative.  Remove the intermediary u32 variable
> to fix this bug.
>
> Fixes: dba2cc03b9db ("scsi: pm80xx: sysfs attribute for non fatal dump")
> Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
> ---
>  drivers/scsi/pm8001/pm8001_ctl.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c
> index bb38b2d63acb..a27f3287748e 100644
> --- a/drivers/scsi/pm8001/pm8001_ctl.c
> +++ b/drivers/scsi/pm8001/pm8001_ctl.c
> @@ -588,10 +588,7 @@ static DEVICE_ATTR(fatal_log, S_IRUGO, pm8001_ctl_fatal_log_show, NULL);
>  static ssize_t non_fatal_log_show(struct device *cdev,
>         struct device_attribute *attr, char *buf)
>  {
> -       u32 count;
> -
> -       count = pm80xx_get_non_fatal_dump(cdev, attr, buf);
> -       return count;
> +       return pm80xx_get_non_fatal_dump(cdev, attr, buf);
>  }
>  static DEVICE_ATTR_RO(non_fatal_log);
>
> --
> 2.53.0
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: pm8001: Fix error code in non_fatal_log_show()
  2026-05-30 19:45 [PATCH] scsi: pm8001: Fix error code in non_fatal_log_show() Dan Carpenter
  2026-06-01  4:59 ` Jinpu Wang
@ 2026-06-02  1:52 ` Martin K. Petersen
  2026-06-09  1:39 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2026-06-02  1:52 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Deepak Ukey, Jack Wang, James E.J. Bottomley, Martin K. Petersen,
	Radha Ramachandran, Viswas G, linux-scsi, linux-kernel,
	kernel-janitors


Dan,

> The non_fatal_log_show() function is supposed to return negative error
> codes on failure. But because the error codes are saved in a u32 and
> then cast to signed long, they end up being high positive values
> instead of negative. Remove the intermediary u32 variable to fix this
> bug.

Applied to 7.2/scsi-staging, thanks!

-- 
Martin K. Petersen

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] scsi: pm8001: Fix error code in non_fatal_log_show()
  2026-05-30 19:45 [PATCH] scsi: pm8001: Fix error code in non_fatal_log_show() Dan Carpenter
  2026-06-01  4:59 ` Jinpu Wang
  2026-06-02  1:52 ` Martin K. Petersen
@ 2026-06-09  1:39 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2026-06-09  1:39 UTC (permalink / raw)
  To: Deepak Ukey, Dan Carpenter
  Cc: Martin K . Petersen, Jack Wang, James E.J. Bottomley,
	Radha Ramachandran, Viswas G, linux-scsi, linux-kernel,
	kernel-janitors

On Sat, 30 May 2026 22:45:48 +0300, Dan Carpenter wrote:

> The non_fatal_log_show() function is supposed to return negative
> error codes on failure.  But because the error codes are saved in
> a u32 and then cast to signed long, they end up being high positive
> values instead of negative.  Remove the intermediary u32 variable
> to fix this bug.
> 
> 
> [...]

Applied to 7.2/scsi-queue, thanks!

[1/1] scsi: pm8001: Fix error code in non_fatal_log_show()
      https://git.kernel.org/mkp/scsi/c/1b6f03b7ae9e

-- 
Martin K. Petersen

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-06-09  1:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-30 19:45 [PATCH] scsi: pm8001: Fix error code in non_fatal_log_show() Dan Carpenter
2026-06-01  4:59 ` Jinpu Wang
2026-06-02  1:52 ` Martin K. Petersen
2026-06-09  1:39 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome