mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "J.A. Magallon" <jamagallon@able.es>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] more signed char cleanups in scripts
Date: Tue, 21 Jun 2005 22:59:40 +0000	[thread overview]
Message-ID: <1119394780l.25237l.4l@werewolf.able.es> (raw)
In-Reply-To: <20050621151806.07ef0f78.akpm@osdl.org> (from akpm@osdl.org on Wed Jun 22 00:18:06 2005)


On 06.22, Andrew Morton wrote:
> "J.A. Magallon" <jamagallon@able.es> wrote:
> >
> > This cleans the last signedness problems I have seen in scripts, at least
> >  what I can see with make oldconfig, make config, make menuconfig, 
> >  make gconfig and make.
> 
> Remind me: what's the point in these changes?
> 
> I see no particular problem using uchar in the kallsyms code - I often
> prefer it, because you can just look at the code and not have to worry
> about nasty sign-extension problems.
> 

Forget the part for kallsyms. After my change, it just coredumps.
The original gcc warnings are below. The problem is using str---
on data that are not strictly strings, but arrays of bytes...
Each symbol struct has a field. 'sym', that stores a 'type'
in sym[0] and a name from sym[1] to the end. A strange hacky mix.

At the end there is one another patch, this time at least kallsyms
works. Dump my previous try and get this. If you don't like the casts,
some strcmp's could be changed to memcmp (a,"b", sizeof("b"));

werewolf:/usr/src/linux# rm -f scripts/kallsyms; make scripts/kallsyms
  HOSTCC  scripts/kallsyms
scripts/kallsyms.c: In function 'read_symbol':
scripts/kallsyms.c:163: warning: pointer targets in assignment differ in signedness
scripts/kallsyms.c:164: warning: pointer targets in passing argument 1 of 'strcpy' differ in signedness
scripts/kallsyms.c: In function 'symbol_valid':
scripts/kallsyms.c:210: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
scripts/kallsyms.c:210: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
scripts/kallsyms.c:210: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
scripts/kallsyms.c:210: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
scripts/kallsyms.c:210: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
scripts/kallsyms.c:210: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
scripts/kallsyms.c:211: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
scripts/kallsyms.c:211: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
scripts/kallsyms.c:211: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
scripts/kallsyms.c:211: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
scripts/kallsyms.c:211: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
scripts/kallsyms.c:211: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
scripts/kallsyms.c:212: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
scripts/kallsyms.c:212: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
scripts/kallsyms.c:212: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
scripts/kallsyms.c:212: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
scripts/kallsyms.c:212: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
scripts/kallsyms.c:212: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
scripts/kallsyms.c:217: warning: pointer targets in passing argument 1 of 'strstr' differ in signedness
scripts/kallsyms.c:221: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
scripts/kallsyms.c:221: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
scripts/kallsyms.c:221: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness
scripts/kallsyms.c:221: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
scripts/kallsyms.c:221: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness
scripts/kallsyms.c:221: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness

--- linux-2.6.12-jam1/scripts/mod/sumversion.c.orig	2005-06-21 23:44:30.000000000 +0200
+++ linux-2.6.12-jam1/scripts/mod/sumversion.c	2005-06-21 23:47:09.000000000 +0200
@@ -252,9 +252,9 @@
 }
 
 /* FIXME: Handle .s files differently (eg. # starts comments) --RR */
-static int parse_file(const signed char *fname, struct md4_ctx *md)
+static int parse_file(const char *fname, struct md4_ctx *md)
 {
-	signed char *file;
+	char *file;
 	unsigned long i, len;
 
 	file = grab_file(fname, &len);
@@ -332,7 +332,7 @@
 	   Sum all files in the same dir or subdirs.
 	*/
 	while ((line = get_next_line(&pos, file, flen)) != NULL) {
-		signed char* p = line;
+		char* p = line;
 		if (strncmp(line, "deps_", sizeof("deps_")-1) == 0) {
 			check_files = 1;
 			continue;
@@ -458,7 +458,7 @@
 	close(fd);
 }
 
-static int strip_rcs_crap(signed char *version)
+static int strip_rcs_crap(char *version)
 {
 	unsigned int len, full_len;
 
--- linux-2.6.12-jam1/scripts/lxdialog/inputbox.c.orig	2005-06-21 23:40:27.000000000 +0200
+++ linux-2.6.12-jam1/scripts/lxdialog/inputbox.c	2005-06-21 23:42:39.000000000 +0200
@@ -21,7 +21,7 @@
 
 #include "dialog.h"
 
-unsigned char dialog_input_result[MAX_LEN + 1];
+char dialog_input_result[MAX_LEN + 1];
 
 /*
  *  Print the termination buttons
@@ -48,7 +48,7 @@
 {
     int i, x, y, box_y, box_x, box_width;
     int input_x = 0, scroll = 0, key = 0, button = -1;
-    unsigned char *instr = dialog_input_result;
+    char *instr = dialog_input_result;
     WINDOW *dialog;
 
     /* center dialog box on screen */
--- linux-2.6.12-jam1/scripts/lxdialog/dialog.h.orig	2005-06-21 23:42:55.000000000 +0200
+++ linux-2.6.12-jam1/scripts/lxdialog/dialog.h	2005-06-21 23:43:19.000000000 +0200
@@ -163,7 +163,7 @@
 int dialog_checklist (const char *title, const char *prompt, int height,
 		int width, int list_height, int item_no,
 		const char * const * items, int flag);
-extern unsigned char dialog_input_result[];
+extern char dialog_input_result[];
 int dialog_inputbox (const char *title, const char *prompt, int height,
 		int width, const char *init);
 
--- linux-2.6.12-jam1/scripts/conmakehash.c.orig	2005-06-22 00:16:58.000000000 +0200
+++ linux-2.6.12-jam1/scripts/conmakehash.c	2005-06-22 00:17:21.000000000 +0200
@@ -33,7 +33,7 @@
 
 int getunicode(char **p0)
 {
-  unsigned char *p = *p0;
+  char *p = *p0;
 
   while (*p == ' ' || *p == '\t')
     p++;
--- linux-2.6.12-jam1/scripts/kallsyms.c.orig	2005-06-22 00:29:29.000000000 +0200
+++ linux-2.6.12-jam1/scripts/kallsyms.c	2005-06-22 00:47:56.000000000 +0200
@@ -160,8 +160,8 @@
 	/* include the type field in the symbol name, so that it gets
 	 * compressed together */
 	s->len = strlen(str) + 1;
-	s->sym = (char *) malloc(s->len + 1);
-	strcpy(s->sym + 1, str);
+	s->sym = malloc(s->len + 1);
+	memcpy(s->sym + 1, str, s->len);
 	s->sym[0] = s->type;
 
 	return 0;
@@ -207,18 +207,18 @@
 		 * move then they may get dropped in pass 2, which breaks the
 		 * kallsyms rules.
 		 */
-		if ((s->addr == _etext && strcmp(s->sym + offset, "_etext")) ||
-		    (s->addr == _einittext && strcmp(s->sym + offset, "_einittext")) ||
-		    (s->addr == _eextratext && strcmp(s->sym + offset, "_eextratext")))
+		if ((s->addr == _etext && strcmp((char*)s->sym + offset, "_etext")) ||
+		    (s->addr == _einittext && strcmp((char*)s->sym + offset, "_einittext")) ||
+		    (s->addr == _eextratext && strcmp((char*)s->sym + offset, "_eextratext")))
 			return 0;
 	}
 
 	/* Exclude symbols which vary between passes. */
-	if (strstr(s->sym + offset, "_compiled."))
+	if (strstr((char*)s->sym + offset, "_compiled."))
 		return 0;
 
 	for (i = 0; special_symbols[i]; i++)
-		if( strcmp(s->sym + offset, special_symbols[i]) == 0 )
+		if( strcmp((char*)s->sym + offset, special_symbols[i]) == 0 )
 			return 0;
 
 	return 1;

--
J.A. Magallon <jamagallon()able!es>     \               Software is like sex:
werewolf!able!es                         \         It's better when it's free
Mandriva Linux release 2006.0 (Cooker) for i586
Linux 2.6.12-jam1 (gcc 4.0.1 (4.0.1-0.2mdk for Mandriva Linux release 2006.0))



  reply	other threads:[~2005-06-21 23:12 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-20  6:30 2.6.12-mm1 Andrew Morton
2005-06-20  6:57 ` 2.6.12-mm1 Benjamin Herrenschmidt
2005-06-20  8:54   ` 2.6.12-mm1 Ethan Benson
2005-06-20  7:46 ` 2.6.12-mm1 Brice Goglin
2005-06-20  8:14   ` 2.6.12-mm1 Dominik Brodowski
2005-06-20  8:49     ` 2.6.12-mm1 Brice Goglin
     [not found]       ` <20050620085449.GA32330@isilmar.linta.de>
2005-06-20 13:11         ` 2.6.12-mm1 Brice Goglin
2005-06-22 23:34           ` 2.6.12-mm1 Rajesh Shah
2005-06-23  6:25             ` 2.6.12-mm1 Brice Goglin
2005-06-23 17:05               ` 2.6.12-mm1 Rajesh Shah
2005-06-23 18:09                 ` 2.6.12-mm1 Brice Goglin
2005-06-23 20:32                   ` 2.6.12-mm1 Rajesh Shah
2005-06-23 21:07                     ` 2.6.12-mm1 Brice Goglin
2005-06-23 21:33                       ` 2.6.12-mm1 Brice Goglin
2005-06-20  7:59 ` 2.6.12-mm1 Brice Goglin
2005-06-21 12:40   ` 2.6.12-mm1 Brice Goglin
2005-06-21 16:27     ` 2.6.12-mm1 Takashi Iwai
2005-06-21 16:32       ` 2.6.12-mm1 Takashi Iwai
2005-06-21 17:02       ` 2.6.12-mm1 Brice Goglin
2005-06-21 17:16         ` 2.6.12-mm1 Takashi Iwai
2005-06-21 19:39           ` 2.6.12-mm1 Brice Goglin
2005-06-22 10:10             ` 2.6.12-mm1 Takashi Iwai
2005-06-20  9:48 ` [patch] 2.6.12-mm1: saa7134-core.c compile error Adrian Bunk
2005-06-20 22:19   ` Michael Krufky
2005-06-20 11:36 ` [PATCH] bttv fix [was: 2.6.12-mm1] J.A. Magallon
2005-06-20 11:38 ` 2.6.12-mm1 J.A. Magallon
2005-06-20 16:36   ` 2.6.12-mm1 Jeff Garzik
2005-06-20 22:35     ` 2.6.12-mm1 J.A. Magallon
2005-06-20 12:32 ` [PATCH] Fix Reiser4 Dependencies Andrew James Wade
2005-06-20 18:26   ` Hans Reiser
2005-06-20 20:44     ` Andrew James Wade
2005-06-21 11:27       ` Edward Shishkin
2005-06-21 18:47         ` Hans Reiser
2005-06-21 19:26           ` Andrew James Wade
2005-06-22  8:56             ` Edward Shishkin
2005-06-22  8:39           ` Edward Shishkin
2005-06-20 13:14 ` 2.6.12-mm1 Andy Whitcroft
2005-06-21 22:55   ` 2.6.12-mm1 Greg KH
2005-06-22  9:23     ` 2.6.12-mm1 Andy Whitcroft
2005-06-22 10:04       ` 2.6.12-mm1 Ivan Kokshaysky
2005-06-20 13:21 ` 2.6.12-mm1: Kernel BUG at "fs/open.c":935 Rafael J. Wysocki
2005-06-20 13:54   ` Dipankar Sarma
2005-06-20 14:05     ` Rafael J. Wysocki
2005-06-20 17:38 ` 2.6.12-mm1: drivers/misc/ibmasm/ compile error Adrian Bunk
2005-06-20 20:24   ` Andrew Morton
2005-06-20 18:29 ` 2.6.12-mm1 Jean Delvare
2005-06-20 20:41   ` 2.6.12-mm1 Andrew Morton
2005-06-20 21:11     ` 2.6.12-mm1 Jean Delvare
2005-06-20 21:23       ` 2.6.12-mm1 Andrew Morton
2005-06-20 21:42         ` 2.6.12-mm1 Jean Delvare
2005-06-20 21:53           ` 2.6.12-mm1 Andrew Morton
2005-06-21 20:06           ` 2.6.12-mm1 Mauro Carvalho Chehab
2005-06-21 21:25             ` 2.6.12-mm1 Jean Delvare
2005-06-20 18:39 ` gregkh-usb-usb-isp116x-hcd-add.patch (was 2.6.12-mm1) Alexey Dobriyan
2005-06-20 22:15 ` 2.6.12-mm1 J.A. Magallon
2005-06-20 22:34   ` iptables bug (was: Re: 2.6.12-mm1) Andrew Morton
2005-06-20 23:39     ` iptables bug Patrick McHardy
2005-06-21 19:21       ` Stephen Jones
2005-06-22  1:52         ` Patrick McHardy
2005-06-21 22:09 ` [PATCH] more signed char cleanups in scripts J.A. Magallon
2005-06-21 22:18   ` Andrew Morton
2005-06-21 22:59     ` J.A. Magallon [this message]
2005-06-22 11:46       ` Paulo Marques
2005-06-22  0:05     ` Lee Revell

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=1119394780l.25237l.4l@werewolf.able.es \
    --to=jamagallon@able.es \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome