Re: [PATCH] 2.4.4-ac11 network drivers cleaning

2001-05-20 Thread Alan Cox

> > printk("%s\n", version);
> > 
> > Not quite as optimal but safer.
> 
> I disagree.   Don't work around an escape bug in a version string, fix
> it...

A % in a version string might be quite reasonable. You are asking to have
an accident by avoiding it. If you want to fight over 4 bytes, then add
a single constant "%s\n", and #define putk() from it


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: [PATCH] 2.4.4-ac11 network drivers cleaning

2001-05-20 Thread Andrzej Krzysztofowicz

> 
> On Sat, 19 May 2001 17:58:49 -0400, 
> Jeff Garzik <[EMAIL PROTECTED]> wrote:
> >Finally, I don't know if I mentioned this earlier, but to be complete
> >and optimal, version strings should be a single variable 'version', such
> >that it can be passed directly to printk like
> >
> > printk(version);
> 
> Nit pick.  That has random side effects if version contains any '%'
> characters.  Make it

It should not. I see no reason for a literal % in the version string.

> 
>   printk("%s\n", version);
> 
> Not quite as optimal but safer.

It is simpler to remove the %s from version. I don't think any of them
require it. If one add a % he should know what he is doing.

-- 
===
  Andrzej M. Krzysztofowicz   [EMAIL PROTECTED]
  tel.  (0-58) 347 14 61
Wydz.Fizyki Technicznej i Matematyki Stosowanej Politechniki Gdanskiej
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: [PATCH] 2.4.4-ac11 network drivers cleaning

2001-05-19 Thread Jeff Garzik

Keith Owens wrote:
> 
> On Sat, 19 May 2001 17:58:49 -0400,
> Jeff Garzik <[EMAIL PROTECTED]> wrote:
> >Finally, I don't know if I mentioned this earlier, but to be complete
> >and optimal, version strings should be a single variable 'version', such
> >that it can be passed directly to printk like
> >
> >   printk(version);
> 
> Nit pick.  That has random side effects if version contains any '%'
> characters.  Make it
> 
> printk("%s\n", version);
> 
> Not quite as optimal but safer.

I disagree.   Don't work around an escape bug in a version string, fix
it...

-- 
Jeff Garzik  | "Do you have to make light of everything?!"
Building 1024| "I'm extremely serious about nailing your
MandrakeSoft |  step-daughter, but other than that, yes."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: [PATCH] 2.4.4-ac11 network drivers cleaning

2001-05-19 Thread Keith Owens

On Sat, 19 May 2001 17:58:49 -0400, 
Jeff Garzik <[EMAIL PROTECTED]> wrote:
>Finally, I don't know if I mentioned this earlier, but to be complete
>and optimal, version strings should be a single variable 'version', such
>that it can be passed directly to printk like
>
>   printk(version);

Nit pick.  That has random side effects if version contains any '%'
characters.  Make it

printk("%s\n", version);

Not quite as optimal but safer.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: [PATCH] 2.4.4-ac11 network drivers cleaning

2001-05-19 Thread Jeff Garzik

Patch looks decent.  Adding module descriptions was quite nice.  One
flaw that is repeated multiple times is that you add

#ifdef MODULE
printk(version);
#endif

in an ISA driver's probe routine.  This instead should always be the
first operation of init_module.

Also make sure to go through the 'ac' patch and review the earlier
version string changes.  Some of them were buggy, like

static const char version[] __initdata =
"...";

const combined with __[dev]initdata causes a section type conflict.  A
few of those popped up after the earlier patch was applied to 'ac'.

Finally, I don't know if I mentioned this earlier, but to be complete
and optimal, version strings should be a single variable 'version', such
that it can be passed directly to printk like

printk(version);

Some net drivers are already like this, as I'm sure you know.  Some net
drivers have 'version', 'version2', 'version3' instead of just one long
string.  Some net drivers add KERN_xxx at printk time, instead of adding
it to the 'version' var.  Some net drivers do the following, which is
really silly considering you know all strings at compile time:

printk(KERN_INFO "%s\n", version);


-- 
Jeff Garzik  | "Do you have to make light of everything?!"
Building 1024| "I'm extremely serious about nailing your
MandrakeSoft |  step-daughter, but other than that, yes."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/