This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH/RFA] Incorrect call to memset in ppc/sim/hw_nvram.c
- From: Ian Lance Taylor <ian at airs dot com>
- To: gdb-patches at sources dot redhat dot com
- Cc: ian at airs dot com
- Date: 14 May 2003 15:30:05 -0700
- Subject: [PATCH/RFA] Incorrect call to memset in ppc/sim/hw_nvram.c
There is an apparently incorrect call to memset in ppc/sim/hw_nvram.c.
The call is intended to zero out memory, but the zero was passed as
the size argument, turning the call into a nop.
I have no idea what problems this could cause, if any.
Here is the patch.
Ian
2003-05-14 Ian Lance Taylor <ian@airs.com>
* hw_nvram.c (hw_nvram_init_address): Correct call to memset--swap
second and third arguments.
Index: hw_nvram.c
===================================================================
RCS file: /cvs/src/src/sim/ppc/hw_nvram.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 hw_nvram.c
--- hw_nvram.c 16 Apr 1999 01:35:09 -0000 1.1.1.1
+++ hw_nvram.c 14 May 2003 22:22:07 -0000
@@ -140,7 +140,7 @@
nvram->memory = zalloc(nvram->sizeof_memory);
}
else
- memset(nvram->memory, nvram->sizeof_memory, 0);
+ memset(nvram->memory, 0, nvram->sizeof_memory);
if (device_find_property(me, "timezone") == NULL)
nvram->timezone = 0;