Re: [PATCH] policy.c: prevent NULL pointer referencing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 07 2018, Gioh Kim wrote:

> paths could be NULL and paths[0] should be followed by NULL pointer
> checking.

Yes, path_policy() can sometimes be passed a NULL pointers for paths.

Reviewed-by: NeilBrown <neilb@xxxxxxxx>

Thanks,
NeilBrown

>
> Signed-off-by: Gioh Kim <gi-oh.kim@xxxxxxxxxxxxxxx>
> ---
>  policy.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/policy.c b/policy.c
> index fa67d55..e3a0671 100644
> --- a/policy.c
> +++ b/policy.c
> @@ -383,7 +383,7 @@ struct dev_policy *path_policy(char **paths, char *type)
>  	/* Now add any metadata-specific internal knowledge
>  	 * about this path
>  	 */
> -	for (i=0; paths[0] && superlist[i]; i++)
> +	for (i=0; paths && paths[0] && superlist[i]; i++)
>  		if (superlist[i]->get_disk_controller_domain) {
>  			const char *d =
>  				superlist[i]->get_disk_controller_domain(
> -- 
> 2.18.0

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux