Re: [PATCH 3/3 V2] libfrog: handle NULL dir && blkdev in __fs_table_lookup_mount

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

 



On Tue, Mar 27, 2018 at 05:33:11PM -0500, Eric Sandeen wrote:
> If neither dir nor blkdev is set, dpath never gets set,
> and then gets used (uninitalized) later on.
> 
> If we are asked where "nothing" is mounted, just return
> "nowhere."
> 
> Fixes-coverity-id: 1433615
> Fixes-coverity-id: 1433616
> Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>

 mmmmmm  mmmm  m    m   mmm         m    m   mm   mmmmm  mmmmm m     m
     #" m"  "m ##  ## m"   "        #    #   ##   #   "# #   "# "m m"
   m#   #    # # ## # #   mm        #mmmm#  #  #  #mmm#" #mmm#"  "#"
  m"    #    # # "" # #    #        #    #  #mm#  #      #        #
 ##mmmm  #mm#  #    #  "mmm"        #    # #    # #      #        #
Reviewed-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

--D

> ---
> 
> V2: wrappers prevent (sic) both being set, gracefully
> handle either of the sent-in paths being null.
> 
> diff --git a/libfrog/paths.c b/libfrog/paths.c
> index 318b48f..c7895e9 100644
> --- a/libfrog/paths.c
> +++ b/libfrog/paths.c
> @@ -98,6 +98,9 @@ __fs_table_lookup_mount(
>  	char		rpath[PATH_MAX];
>  	char		dpath[PATH_MAX];
>  
> +	if (!dir && !blkdev)
> +		return NULL;
> +
>  	if (dir && !realpath(dir, dpath))
>  		return NULL;
>  	if (blkdev && !realpath(blkdev, dpath))
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux