Re: warning: cast adds address space to expression

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

 



Quoting Jaswinder Singh <jaswinder@xxxxxxxxxxxxx>:

Hello all,

I am trying to solve sparse warnings in kernel.

Please let me know how can I solve following sparse warning :-

warning: cast adds address space to expression

Is this a warning or a Info.

It's a warning.  The code must be doing something like this:

void *addr1;
void __iomem *addr2;

addr2 = (void __iomem *) addr1;

If any sparse documentation is available, please let me know.

I don't think you need sparse documentation to resolve it. Sparse only detected a bad cast, but fixing it requires deeper understanding of the code, not of the warning.

You should look at the expression and see if the value before cast needs the attribute, or the value after the cast doesn't need the attribute.

The meanings of attributes in Linux are:

__user - pointer to data that came from the userspace
__iomem - pointer to a device I/O area (ports or I/O memory)

There are functions that deal with such pointers. The code you are dealing with may be trying to circumvent those functions.

Further questions are better asked in Linux specific lists with more details of the code. Please note that you should understand the code to fix it. Just fixing the warning without understanding the problem is defeating the whole purpose of sparse.

--
Regards,
Pavel Roskin
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux