* [PATCH] pata_legacy: fix a couple uninitialized variable bugs
@ 2021-10-06 7:34 Dan Carpenter
2021-10-12 0:54 ` Damien Le Moal
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2021-10-06 7:34 UTC (permalink / raw)
To: Damien Le Moal
Cc: Tejun Heo, Jeff Garzik, linux-ide, linux-kernel, kernel-janitors
The last byte of "pad" is used without being initialized.
Fixes: 55dba3120fbc ("libata: update ->data_xfer hook for ATAPI")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/ata/pata_legacy.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
index c3e6592712c4..b53f0e09783d 100644
--- a/drivers/ata/pata_legacy.c
+++ b/drivers/ata/pata_legacy.c
@@ -352,7 +352,7 @@ static unsigned int pdc_data_xfer_vlb(struct ata_queued_cmd *qc,
iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
if (unlikely(slop)) {
- __le32 pad;
+ __le32 pad = 0;
if (rw == READ) {
pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr));
memcpy(buf + buflen - slop, &pad, slop);
@@ -742,7 +742,7 @@ static unsigned int vlb32_data_xfer(struct ata_queued_cmd *qc,
ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
if (unlikely(slop)) {
- __le32 pad;
+ __le32 pad = 0;
if (rw == WRITE) {
memcpy(&pad, buf + buflen - slop, slop);
iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr);
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] pata_legacy: fix a couple uninitialized variable bugs
2021-10-06 7:34 [PATCH] pata_legacy: fix a couple uninitialized variable bugs Dan Carpenter
@ 2021-10-12 0:54 ` Damien Le Moal
2021-10-12 6:36 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Damien Le Moal @ 2021-10-12 0:54 UTC (permalink / raw)
To: Dan Carpenter
Cc: Tejun Heo, Jeff Garzik, linux-ide, linux-kernel, kernel-janitors
On 10/6/21 16:34, Dan Carpenter wrote:
> The last byte of "pad" is used without being initialized.
>
> Fixes: 55dba3120fbc ("libata: update ->data_xfer hook for ATAPI")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> drivers/ata/pata_legacy.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/ata/pata_legacy.c b/drivers/ata/pata_legacy.c
> index c3e6592712c4..b53f0e09783d 100644
> --- a/drivers/ata/pata_legacy.c
> +++ b/drivers/ata/pata_legacy.c
> @@ -352,7 +352,7 @@ static unsigned int pdc_data_xfer_vlb(struct ata_queued_cmd *qc,
> iowrite32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
>
> if (unlikely(slop)) {
> - __le32 pad;
> + __le32 pad = 0;
> if (rw == READ) {
> pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr));
> memcpy(buf + buflen - slop, &pad, slop);
> @@ -742,7 +742,7 @@ static unsigned int vlb32_data_xfer(struct ata_queued_cmd *qc,
> ioread32_rep(ap->ioaddr.data_addr, buf, buflen >> 2);
>
> if (unlikely(slop)) {
> - __le32 pad;
> + __le32 pad = 0;
> if (rw == WRITE) {
> memcpy(&pad, buf + buflen - slop, slop);
> iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr);
>
Applied to for-5.15-fixes. Thanks !
(Note: I added a blank line after the pad declaration to follow kernel
style).
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] pata_legacy: fix a couple uninitialized variable bugs
2021-10-12 0:54 ` Damien Le Moal
@ 2021-10-12 6:36 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-10-12 6:36 UTC (permalink / raw)
To: Damien Le Moal
Cc: Tejun Heo, Jeff Garzik, linux-ide, linux-kernel, kernel-janitors
On Tue, Oct 12, 2021 at 09:54:49AM +0900, Damien Le Moal wrote:
> (Note: I added a blank line after the pad declaration to follow kernel
> style).
I wanted to do that too, but took the more conservative approach. Thanks!
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-12 6:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-06 7:34 [PATCH] pata_legacy: fix a couple uninitialized variable bugs Dan Carpenter
2021-10-12 0:54 ` Damien Le Moal
2021-10-12 6:36 ` 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).