mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 08:42:12 +02:00
lib/vsprintf.c: don't special-case pointers to address null
The %p format of printf() would print a pointer to address null as "(null)". This makes sense in a real OS where a NULL pointer must never be dereferenced, but this is a bootloader, and there are cases where accessing the data at address null makes perfect sense. Remove the special case in lib/vsprintf.c using "#if 0" with a comment to make clear this was an intentional change and to stop re-adding this code. Signed-off-by: Wolfgang Denk <wd@denx.de> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
@@ -495,9 +495,15 @@ static char *ip4_addr_string(char *buf, char *end, u8 *addr, int field_width,
|
|||||||
static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
|
static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
|
||||||
int field_width, int precision, int flags)
|
int field_width, int precision, int flags)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Being a boot loader, we explicitly allow pointers to
|
||||||
|
* (physical) address null.
|
||||||
|
*/
|
||||||
|
#if 0
|
||||||
if (!ptr)
|
if (!ptr)
|
||||||
return string(buf, end, "(null)", field_width, precision,
|
return string(buf, end, "(null)", field_width, precision,
|
||||||
flags);
|
flags);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_CMD_NET
|
#ifdef CONFIG_CMD_NET
|
||||||
switch (*fmt) {
|
switch (*fmt) {
|
||||||
|
Reference in New Issue
Block a user