From: Daniel Mack <daniel@zonque.org>
To: "Randy.Dunlap" <randy.dunlap@verizon.net>
Cc: lkml <linux-kernel@vger.kernel.org>,
daniel@zonque.org, akpm <akpm@osdl.org>
Subject: Re: [PATCH] 2.6.4-rc2: scripts/modpost.c
Date: Fri, 5 Mar 2004 13:36:08 +0100 [thread overview]
Message-ID: <20040305123608.GJ5569@zonque.dyndns.org> (raw)
In-Reply-To: <20040304212440.30fc8674.randy.dunlap@verizon.net>
On Thu, Mar 04, 2004 at 09:24:40PM -0800, Randy.Dunlap wrote:
> The comment and code certainly don't match, and your patch makes sense
> to me. However, I can't reproduce the problem that you describe.
>
> I built the kernel image and modules in "www.osdl.org/264rc2/build1",
> and all *.mod.c and *.ko ended up there with no problems.
This only occurs if you try to build kernel modules externally like
described in http://linuxdevices.com/articles/AT4389927951.html.
The DVB driver from CVS does it like this, I'm sure there are many
more cases where this could lead to problems.
> Andrew, I applied the patch and didn't have any problems with
> 'make allyesconfig' like you alluded to.
Hmm, here is a compiler warning when builing modpost since my patch
accesses const char* memory directly (right after malloc()ing it).
The following patch has exactly the same effect but also makes gcc
happy.
diff -ru linux-2.6.4-rc2.orig/scripts/modpost.c linux-2.6.4-rc2/scripts/modpost.c
--- linux-2.6.4-rc2.orig/scripts/modpost.c 2004-03-04 11:40:21.000000000 +0100
+++ linux-2.6.4-rc2/scripts/modpost.c 2004-03-05 12:10:24.000000000 +0100
@@ -63,17 +63,18 @@
new_module(char *modname)
{
struct module *mod;
- char *p;
+ int len;
mod = NOFAIL(malloc(sizeof(*mod)));
memset(mod, 0, sizeof(*mod));
- mod->name = NOFAIL(strdup(modname));
-
+ len = strlen(modname);
+
/* strip trailing .o */
- p = strstr(mod->name, ".o");
- if (p)
- *p = 0;
-
+ if (len > 2 && modname[len-2] == '.' && modname[len-1] == 'o')
+ len -= 2;
+
+ mod->name = NOFAIL(strndup(modname, len));
+
/* add to list */
mod->next = modules;
modules = mod;
diff -ru linux-2.6.4-rc2.orig/scripts/modpost.h linux-2.6.4-rc2/scripts/modpost.h
--- linux-2.6.4-rc2.orig/scripts/modpost.h 2004-03-04 11:40:21.000000000 +0100
+++ linux-2.6.4-rc2/scripts/modpost.h 2004-03-05 12:10:51.000000000 +0100
@@ -1,3 +1,5 @@
+#define _GNU_SOURCE
+
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
Daniel
next prev parent reply other threads:[~2004-03-05 11:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20040304172923.6045760e.rddunlap@osdl.org>
2004-03-05 5:24 ` [PATCH] 2.6.4-rc2: scripts/modpost.c Randy.Dunlap
2004-03-05 6:16 ` Tony Breeds
2004-03-05 12:36 ` Daniel Mack [this message]
2004-03-04 11:37 Daniel Mack
2004-03-04 11:54 ` Andrew Morton
2004-03-04 13:01 ` Daniel Mack
2004-03-11 0:40 ` Rusty Russell
2004-03-11 5:53 ` Sam Ravnborg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040305123608.GJ5569@zonque.dyndns.org \
--to=daniel@zonque.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=randy.dunlap@verizon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox