Re: [PATCH v7 01/11] libata: fix ata_host_alloc_pinfo()

From
Hannes Reinecke <hare@suse.de>
Date
2021-08-16 05:53:36
Also in
linux-block
Reply to
Damien Le Moal, 2021-08-16
On 8/16/21 3:44 AM, Damien Le Moal wrote:
Avoid static checkers warnings about a potential NULL pointer
dereference for the port info variable pi. To do so, test that at least
one port info is available on entry to ata_host_alloc_pinfo() and start
the ata port initialization for() loop with pi initialized to the first
port info passed as argument (which is already checked to be non NULL).
Within the for() loop, get the next port info, if it is not NULL,
after initializing the ata port using the previous port info.

Reported-by: kernel test robot <redacted>
Signed-off-by: Damien Le Moal <redacted>
---
  drivers/ata/libata-core.c | 18 ++++++++++++++----
  1 file changed, 14 insertions(+), 4 deletions(-)
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                Kernel Storage Architect
hare@suse.de                              +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
Thread (21 messages) 21 messages, 4 authors, last reply 2021-08-18
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help