Re: [PATCH 1/4] Get rid of XFS_BUF_PTR() macro

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

 



On Wed, Mar 07, 2018 at 09:22:10AM +1100, Dave Chinner wrote:
> On Tue, Mar 06, 2018 at 02:00:50PM +0100, Carlos Maiolino wrote:
> > Signed-off-by: Carlos Maiolino <cmaiolino@xxxxxxxxxx>
> .....
> > @@ -275,9 +275,9 @@ newfile(
> >  		d = XFS_FSB_TO_DADDR(mp, map.br_startblock);
> >  		bp = libxfs_trans_get_buf(logit ? tp : 0, mp->m_dev, d,
> >  			nb << mp->m_blkbb_log, 0);
> > -		memmove(XFS_BUF_PTR(bp), buf, len);
> > +		memmove(bp->b_addr, buf, len);
> >  		if (len < XFS_BUF_COUNT(bp))
> > -			memset(XFS_BUF_PTR(bp) + len, 0, XFS_BUF_COUNT(bp) - len);
> > +			memset(bp->b_addr + len, 0, XFS_BUF_COUNT(bp) - len);
> 
> Bug there. pointer arithmetic changed, needs (char *) cast.

Not really.  In standard C pointer arithmetics on void * isn't even
defined, so this won't work.  In the GCC dialect it is defined the same
as on char *.  And I'd much prefer not adding these pointless casts that
just confuse everyone.
--
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