Re: [PATCH 08/18] staging: vchiq_core: simplify vchiq_add_service_internal

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

 



On Tue, Jan 25, 2022 at 01:06:14PM +0300, Pavel Skripkin wrote:
> Hi Dan,
> 
> On 1/25/22 12:59, Dan Carpenter wrote:
> [...]
> 
> > > > -	service->trace         = 0;
> > > >   	atomic_set(&service->poll_flags, 0);
> > > 
> > > Nit: atomic_set(0) can be also removed
> > > 
> > 
> > No, let's not write code that assumes it knows atomic_t internals.
> > 
> 
> Isn't atomic_set() just (let's say) "magic" write to memory in all cases? Am
> I missing some design issue here?
> 

The point is atomic values should only be set using atomic_set/inc/dec()
etc.  Anything else is wrong even if it works.

I think it might trigger a kcsan warning these days?  I don't know what
that instrumentation does.  But even in olden times, the rule was you
always had to use the accessor functions.

regards,
dan carpenter





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux