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 RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux