[Top][All Lists]

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

Re: [PATCH 0/2] util: Resolve issues with use of grub_util_mkdir

From: Daniel Kiper
Subject: Re: [PATCH 0/2] util: Resolve issues with use of grub_util_mkdir
Date: Fri, 19 Aug 2022 19:09:17 +0200
User-agent: NeoMutt/20170113 (1.7.2)

On Tue, Aug 09, 2022 at 01:29:03PM +0000, Darren Kenny wrote:
> Coverity flagged some issues where grub_util_mkdir() was being called but the
> return value was not being checked.
> After examining the implementation, on UNIX and ACROS, grub_util_mkdir() is a
> macro that maps to libc's mkdir(), which returns an int.
> But on MS Windows, grub_util_mkdir() is a function with a void return, and
> which in turn eventually maps to the MS API CreateDirectory() call.
> After discussing with Daniel, it was felt that fixing this by reimplementing
> the Windows code for grub_util_mkdir() to return something like the
> libc equivalents. This and then testing the return values on each call to
> grub_util_mkdir() in the util code is of little benefit when the main usage is
> to populate a temporary directory that was created earlier in the code of
> grub-mkrescue, which should never fail.
> The solution presented in patch 1, to resolve Coverity's concerns is to cast
> the return value of the mkdir() command to void in the macro for
> grub_util_mkdir().
> The other use-case is in the grub_util_mkdir_p() function that creates
> a directory tree, as the UNIX command mkdir -p does. This code should at least
> try confirm that it is successfully creating the parent directories before it
> continues to the sub-directories. This is done by using
> grub_util_is_directory() to ensure that the directory exists, and if it
> doesn't then to call grub_util_error() with some information and exit.
> In fixing this, it was discovered that grub_util_mkdir() was incorrectly being
> called with an empty directory name (""), which was due to an error in the
> tokenisation being performed.
> Darren Kenny (2):
>   util: Ignore return value for grub_util_mkdir() on all platforms
>   util: confirm directory creation in grub_install_mkdir_p

Reviewed-by: Daniel Kiper <>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]