Search Linux Wireless

Re: [PATCH iwlwifi-next] iwlwifi: de-const properly where needed

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

 



On 1 Mar 2021, at 7:23, Kalle Valo wrote:

"Bjoern A. Zeeb" <bz@xxxxxxxxxxx> writes:

In order to de-const variables simply casting through (void *) is
not enough: "cast from 'const .. *' to 'void *' drops const qualifier".
Cast through (uintptr_t) as well [1] to make this compile on systems
with more strict requirements.
In addition passing const void *data to dma_map_single() also
drops the (const) qualifier.  De-constify on variable on assignment
which may be overwritten later.  In either case the (void *) cast
to dma_map_single() is not needed (anymore) either.

[1] See __DECONST() in sys/sys/cdefs.h in FreeBSD

Sponsored-by:  The FreeBSD Foundation
Signed-off-by: Bjoern A. Zeeb <bz@xxxxxxxxxxx>

Why are we using the const in the first place? That sounds like a bug to
me.

For the he_cap cases I’ll leave this to Intel to answer as they added the
comment that it is writeable.


For the dma_map_single(.., DMA_TO_DEVICE) having const data is probably okay. This seems more (and I can only say from the distance not knowing Linux internals) that the Linux KPI doesn’t/cannot cater for it. I am not sure why it would need to change a virtual address along the lines and the argument is not “const”.


BTW, your patches are hard to read due to excessive context, I guess you are using a very large context value with diff? Our recommendation is to
use git with default values, see the wiki below for more info.

Sorry. I’ll fix the three casts you mentioned on the other review and send out
v2 with less context for all of them.


Best Regards,
Bjoern



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux