Re: [PATCH 4/5 v2] set: check seek success

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

 



On Mon, Nov 10, 2014 at 09:51:03AM +0100, Thierry Reding wrote:
> On Sat, Nov 08, 2014 at 11:14:09PM +0100, Patrick Georgi wrote:
> > This could silently fail which leads to surprising behaviour.
> > 
> > Found-by: Coverity Scan
> > Signed-off-by: Patrick Georgi <patrick@xxxxxxxxxxxxxx>
> > ---
> >  src/set.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/set.c b/src/set.c
> > index ff32b53..907d640 100644
> > --- a/src/set.c
> > +++ b/src/set.c
> > @@ -59,7 +59,11 @@ read_from_image(char	*filename,
> >  		return result;
> >  	}
> >  
> > -	fseek(fp, offset, SEEK_SET);
> > +	if (fseek(fp, offset, SEEK_SET) == -1) {
> > +		printf("Error: Couldn't seek to %s(%d)\n", filename, offset);
> 
> offset is unsigned, so the format specifier should be %u. I also wonder
> whether it would be good to output errno along with the message (or the
> string representation thereof) to increase the information content. But
> given that none of the other error messages have that it could be a
> separate patch.
> 
> With the %d -> %u for the format specifier, this is:
> 
> Reviewed-by: Thierry Reding <treding@xxxxxxxxxx>

I just realized that I have commit access to the cbootimage repository,
so I just made the %d -> %u change myself and pushed.

Thanks,
Thierry

Attachment: pgp40Ic54yiE2.pgp
Description: PGP signature


[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux