Linux SPARSE checker discussions
 help / color / mirror / Atom feed
* warning: cast adds address space to expression
@ 2008-07-12  8:57 Jaswinder Singh
  2008-07-12 15:17 ` Pavel Roskin
  0 siblings, 1 reply; 2+ messages in thread
From: Jaswinder Singh @ 2008-07-12  8:57 UTC (permalink / raw)
  To: linux-sparse, David Woodhouse, davej

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.

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

Thank you,

Jaswinder Singh.



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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: warning: cast adds address space to expression
  2008-07-12  8:57 warning: cast adds address space to expression Jaswinder Singh
@ 2008-07-12 15:17 ` Pavel Roskin
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Roskin @ 2008-07-12 15:17 UTC (permalink / raw)
  To: Jaswinder Singh; +Cc: linux-sparse, David Woodhouse, davej

Quoting Jaswinder Singh <jaswinder@infradead.org>:

> 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@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-12 15:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-12  8:57 warning: cast adds address space to expression Jaswinder Singh
2008-07-12 15:17 ` Pavel Roskin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox