All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [PATCH] Silence GCC4 warning: pointer targets in assignment
@ 2005-06-23 21:54 Jesse Millan
  0 siblings, 0 replies; only message in thread
From: Jesse Millan @ 2005-06-23 21:54 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 614 bytes --]


GCC4 compares signedness of all pointer types. Assigning an unsigned
pointer to a signed pointer (or vise-versa) generates a warning. In this
case an unsigned char pointer was assigned the value of a signed char
pointer. It looks like the author was aware of this so I just let it be.
An explicit cast silences the warnings.

BTW, "typedef unsigned char uch" was declared at the top of the file.

misc.c:221: warning: pointer targets in assignment differ in signedness
misc.c:287: warning: pointer targets in assignment differ in signedness
misc.c:304: warning: pointer targets in assignment differ in signedness

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1228 bytes --]

Signed-off-by: Jesse Millan <jessem@cs.pdx.edu>

--- linux-2.6.12-rc6.kj/arch/x86_64/boot/compressed/misc.c~	2005-06-23 12:32:31.266543448 -0700
+++ linux-2.6.12-rc6.kj/arch/x86_64/boot/compressed/misc.c	2005-06-23 13:43:33.809033744 -0700
@@ -218,7 +218,7 @@ static int fill_inbuf(void)
 		error("ran out of input data");
 	}

-	inbuf = input_data;
+	inbuf = (uch *)input_data;
 	insize = input_len;
 	inptr = 1;
 	return inbuf[0];
@@ -284,7 +284,7 @@ void setup_normal_output_buffer(void)
 #else
 	if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < 1024) error("Less than 2MB of memory");
 #endif
-	output_data = (char *)0x100000; /* Points to 1M */
+	output_data = (uch *)0x100000; /* Points to 1M */
 	free_mem_end_ptr = (long)real_mode;
 }

@@ -301,7 +301,7 @@ void setup_output_buffer_if_we_run_high(
 #else
 	if ((ALT_MEM_K > EXT_MEM_K ? ALT_MEM_K : EXT_MEM_K) < (3*1024)) error("Less than 4MB of memory");
 #endif
-	mv->low_buffer_start = output_data = (char *)LOW_BUFFER_START;
+	mv->low_buffer_start = output_data = (uch *)LOW_BUFFER_START;
 	low_buffer_end = ((unsigned int)real_mode > LOW_BUFFER_MAX
 	  ? LOW_BUFFER_MAX : (unsigned int)real_mode) & ~0xfff;
 	low_buffer_size = low_buffer_end - LOW_BUFFER_START;

[-- Attachment #3: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-06-23 21:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-23 21:54 [KJ] [PATCH] Silence GCC4 warning: pointer targets in assignment Jesse Millan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.