xfs
[Top] [All Lists]

Re: [PATCH 15/19] mkfs: don't treat files as though they are block devic

To: xfs@xxxxxxxxxxx
Subject: Re: [PATCH 15/19] mkfs: don't treat files as though they are block devices
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Fri, 8 Apr 2016 23:12:12 -0500
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <CACj3i73JEzCj-4kp3=H9mjXCKYgcOUYCOyq-aZSWZFXUih+0MA@xxxxxxxxxxxxxx>
References: <1458818136-56043-1-git-send-email-jtulak@xxxxxxxxxx> <1458818136-56043-16-git-send-email-jtulak@xxxxxxxxxx> <5706FA7C.7020103@xxxxxxxxxxx> <CACj3i73JEzCj-4kp3=H9mjXCKYgcOUYCOyq-aZSWZFXUih+0MA@xxxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.7.2

On 4/8/16 9:58 AM, Jan Tulak wrote:
>     This one causes at least one interesting issue:
> 
>     #mkfs/mkfs.xfs
>     Error accessing specified device (null): Bad address
>     Usage: mkfs.xfs
>     ...
> 
>     because:
> 
>             check_device_type(dfile, &xi.disfile, !dsize, !dfile,
>                               Nflag ? NULL : &xi.dcreat, force_overwrite, 
> "d");
> 
>     so "dfile" can be NULL, but that function immediately tries to stat it.
> 
> 
> âA simple if NULL, then usage() should take care of this...

Well, think hard about that.  If dfile == NULL and bails with usage(), then
what is the point of having !dfile as a function argument?

Validation of having a target specified as either -dfile= or as the last 
argument
should probably happen before the call to check_device_type.

-Eric

<Prev in Thread] Current Thread [Next in Thread>