Re: [PATCH v7 06/25] RDMA/rtrs: client: main functionality

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

 



On Thu, Jan 16, 2020 at 04:43:41PM +0100, Jinpu Wang wrote:
> > > +             wake_up(&clt->permits_wait);
> > > +}
> > > +EXPORT_SYMBOL(rtrs_clt_put_permit);
> > > +
> > > +struct rtrs_permit *rtrs_permit_from_pdu(void *pdu)
> > > +{
> > > +     return pdu - sizeof(struct rtrs_permit);
> >
> > C standard doesn't allow pointer arithmetic on void*.
> gcc never complains,  searched aournd:
> https://stackoverflow.com/questions/3523145/pointer-arithmetic-for-void-pointer-in-c
> 
> You're right, will fix.

The kernel extensively uses a gcc extension treating arithmatic on a
void * as the same as a u8, you can leave it for kernel code.

But is generally a big question why code is written like that, always
better to use a struct and container_of

Jason



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux