* [PATCH] rts5208: fix a missing check of ms read
@ 2018-12-20 20:00 Kangjie Lu
2018-12-20 20:14 ` Dan Carpenter
2019-01-02 11:30 ` Dan Carpenter
0 siblings, 2 replies; 3+ messages in thread
From: Kangjie Lu @ 2018-12-20 20:00 UTC (permalink / raw)
To: kjlu
Cc: pakki001, Greg Kroah-Hartman, Kees Cook, Arnd Bergmann,
Dan Carpenter, Aymen Qader, devel, linux-kernel
When ms_read_extra_data fails, the data read in "extra" buffer is
just incorrect and thus should be used. However, "extra" is used
in multiple places no matter ms_read_extra_data() fails or not.
The fix checks the status of ms_read_extra_data() and returns with
an error code upon its failure.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/staging/rts5208/ms.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c
index f53adf15c685..03b359ec69e6 100644
--- a/drivers/staging/rts5208/ms.c
+++ b/drivers/staging/rts5208/ms.c
@@ -1676,7 +1676,9 @@ static int ms_copy_page(struct rtsx_chip *chip, u16 old_blk, u16 new_blk,
return STATUS_FAIL;
}
- ms_read_extra_data(chip, old_blk, i, extra, MS_EXTRA_SIZE);
+ retval = ms_read_extra_data(chip, old_blk, i, extra, MS_EXTRA_SIZE);
+ if (retval != STATUS_SUCCESS)
+ return STATUS_FAIL;
retval = ms_set_rw_reg_addr(chip, OverwriteFlag,
MS_EXTRA_SIZE, SystemParm, 6);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] rts5208: fix a missing check of ms read
2018-12-20 20:00 [PATCH] rts5208: fix a missing check of ms read Kangjie Lu
@ 2018-12-20 20:14 ` Dan Carpenter
2019-01-02 11:30 ` Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2018-12-20 20:14 UTC (permalink / raw)
To: Kangjie Lu
Cc: pakki001, Greg Kroah-Hartman, Kees Cook, Arnd Bergmann,
Aymen Qader, devel, linux-kernel
LGTM.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rts5208: fix a missing check of ms read
2018-12-20 20:00 [PATCH] rts5208: fix a missing check of ms read Kangjie Lu
2018-12-20 20:14 ` Dan Carpenter
@ 2019-01-02 11:30 ` Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2019-01-02 11:30 UTC (permalink / raw)
To: Kangjie Lu
Cc: devel, Kees Cook, Arnd Bergmann, Greg Kroah-Hartman,
linux-kernel, pakki001, Aymen Qader
On Thu, Dec 20, 2018 at 02:00:01PM -0600, Kangjie Lu wrote:
> When ms_read_extra_data fails, the data read in "extra" buffer is
> just incorrect and thus should be used. However, "extra" is used
> in multiple places no matter ms_read_extra_data() fails or not.
> The fix checks the status of ms_read_extra_data() and returns with
> an error code upon its failure.
>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Looks good.
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-02 11:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-20 20:00 [PATCH] rts5208: fix a missing check of ms read Kangjie Lu
2018-12-20 20:14 ` Dan Carpenter
2019-01-02 11:30 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).