Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1724951

Re: [PATCH 05/16] fs: fix kernel_read prototype

From Christoph Hellwig <hch@lst.de>
Newsgroups linux.kernel
Subject Re: [PATCH 05/16] fs: fix kernel_read prototype
Date 2017-09-01 12:40 +0200
Message-ID <ukRwJ-2IO-9@gated-at.bofh.it> (permalink)
References <ukcMW-1sy-9@gated-at.bofh.it> <ukcMW-1sy-27@gated-at.bofh.it> <ukdfX-1Et-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Aug 30, 2017 at 04:37:04PM +0100, Al Viro wrote:
> On Wed, Aug 30, 2017 at 04:59:56PM +0200, Christoph Hellwig wrote:
> > Use proper ssize_t and size_t types for the return value and count
> > argument,  move the offset last and make it an in/out argument like
> > all other read/write helpers.
> 
> Might be better to switch the third argument to void * at the same time
> and lose those casts.

Good point, updated.

> 
> >  			if (p)
> >  				memcpy(p + offset, buf, n);
> > -
> > -			offset += n;
> 
> Almost certainly broken - in effect, you've taken the update of offset
> several lines prior, so that memcpy() is getting the wrong first argument.
> The same needs to be watched out for in other similar places.

Fixed.  I did an audit and didn't find any others either for kernel_read
or kernel_write.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 05/16] fs: fix kernel_read prototype Christoph Hellwig <hch@lst.de> - 2017-08-30 17:10 +0200
  Re: [PATCH 05/16] fs: fix kernel_read prototype Al Viro <viro@ZenIV.linux.org.uk> - 2017-08-30 17:40 +0200
    Re: [PATCH 05/16] fs: fix kernel_read prototype Christoph Hellwig <hch@lst.de> - 2017-09-01 12:40 +0200

csiph-web