[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20071129010531.22b3a71f@werewolf>
Date: Thu, 29 Nov 2007 01:05:31 +0100
From: "J.A. Magallón" <jamagallon@....com>
To: "Linux-Kernel, " <linux-kernel@...r.kernel.org>
Subject: void* arithmnetic
Hi all...
Since begin of the ages the build of the nvidia driver says things like
this:
include/asm/compat.h:210: warning: pointer of type 'void *' used in arithmetic
There are several of this warnings. The code in question for this example
is:
static __inline__ void __user *compat_alloc_user_space(long len)
{
struct pt_regs *regs = task_pt_regs(current);
return (void __user *)regs->rsp - len;
}
As this is dealing with mem blocks, I suppose it's counting in bytes, so
we could do something like:
return (void __user *)((u8*)regs->rsp - len);
so the arithmetic knows how to inc/dec for each unity...
I think the warning is correct and that void* arithmetic is undefined in C,
isn't it ?
TIA
--
J.A. Magallon <jamagallon()ono!com> \ Software is like sex:
\ It's better when it's free
Mandriva Linux release 2008.1 (Cooker) for i586
Linux 2.6.23-jam01 (gcc 4.2.2 20070909 (4.2.2-0.RC.1mdv2008.0)) SMP PREEMPT
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists