Re: [PATCH] Use NULL instead of integer 0 in security/selinux/

From: Geert Uytterhoeven
Date: Sun Jul 11 2004 - 05:33:52 EST


On Sat, 10 Jul 2004, Geert Uytterhoeven wrote:
> On Fri, 9 Jul 2004, Roman Zippel wrote:
> > On Thu, 8 Jul 2004, Linus Torvalds wrote:
> > > I have one. It's in my head. It's called the Linux Kernel C standard. Some
> > > of it is documented in CodinggStyle, others is just codified in existing
> > > practice.
> >
> > So far we have been quite liberal in style questions, what annoys me here
> > is that people send warning patches directly to you without even notifying
> > the maintainers. If you want people to conform people to a certain
> > CodingStyle please document officially in the kernel, sparse isn't
> > distributed with the kernel and the sparse police is silently changing the
> > kernel all over the place with sometimes questionable benefit. Only the
>
> I agree, when you're talking about the `if ((x = f())' cases. We already added
> the extra parentheses to shut up gcc...
>
> > __user warnings had really found the bugs, but the rest I've seen changes
> > perfectly legal code.

But why does sparse complain about

p->thread.fs = get_fs().seg;

with

linux-m68k-2.6.7/arch/m68k/kernel/process.c:265:23: warning: expected lvalue for member dereference

? Looks valid to me?

(patch to kill the warning below, _for reference only_)

--- linux-m68k-2.6.7/arch/m68k/kernel/process.c.orig 2004-06-21 20:20:00.000000000 +0200
+++ linux-m68k-2.6.7/arch/m68k/kernel/process.c 2004-06-27 14:47:23.000000000 +0200
@@ -242,6 +242,7 @@
struct pt_regs * childregs;
struct switch_stack * childstack, *stack;
unsigned long stack_offset, *retp;
+ mm_segment_t fs;

stack_offset = THREAD_SIZE - sizeof(struct pt_regs);
childregs = (struct pt_regs *) ((unsigned long) (p->stack) + stack_offset);
@@ -262,7 +263,8 @@
* Must save the current SFC/DFC value, NOT the value when
* the parent was last descheduled - RGH 10-08-96
*/
- p->thread.fs = get_fs().seg;
+ fs = get_fs();
+ p->thread.fs = fs.seg;

if (!FPU_IS_EMU) {
/* Copy the current fpu state */

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/