# Re: \[PATCH v7 01/11\] libata: fix ata\_host\_alloc\_pinfo()

- From: Hannes Reinecke \<hare@suse.de\>
- Date: 2021-08-16 05:53:36 
- List: linux-block
- Page: https://ratatoskr.run/linux-block/2021/08/6404701
- Thread: https://ratatoskr.run/linux-ide/2021/08/6404689/t.md

```text
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
```
