aboutsummaryrefslogtreecommitdiffstats
path: root/lib/vsprintf.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-09-24 18:13:11 -0400
committerDavid S. Miller <davem@davemloft.net>2009-09-24 18:13:11 -0400
commit8b3f6af86378d0a10ca2f1ded1da124aef13b62c (patch)
treede6ca90295730343c495be8d98be8efa322140ef /lib/vsprintf.c
parent139d6065c83071d5f66cd013a274a43699f8e2c1 (diff)
parent94e0fb086fc5663c38bbc0fe86d698be8314f82f (diff)
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Conflicts: drivers/staging/Kconfig drivers/staging/Makefile drivers/staging/cpc-usb/TODO drivers/staging/cpc-usb/cpc-usb_drv.c drivers/staging/cpc-usb/cpc.h drivers/staging/cpc-usb/cpc_int.h drivers/staging/cpc-usb/cpcusb.h
Diffstat (limited to 'lib/vsprintf.c')
-rw-r--r--lib/vsprintf.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index a1941f8d205f..b91839e9e892 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -581,7 +581,7 @@ static char *symbol_string(char *buf, char *end, void *ptr,
581 unsigned long value = (unsigned long) ptr; 581 unsigned long value = (unsigned long) ptr;
582#ifdef CONFIG_KALLSYMS 582#ifdef CONFIG_KALLSYMS
583 char sym[KSYM_SYMBOL_LEN]; 583 char sym[KSYM_SYMBOL_LEN];
584 if (ext != 'f') 584 if (ext != 'f' && ext != 's')
585 sprint_symbol(sym, value); 585 sprint_symbol(sym, value);
586 else 586 else
587 kallsyms_lookup(value, NULL, NULL, NULL, sym); 587 kallsyms_lookup(value, NULL, NULL, NULL, sym);
@@ -799,7 +799,8 @@ static char *ip4_addr_string(char *buf, char *end, const u8 *addr,
799 * 799 *
800 * - 'F' For symbolic function descriptor pointers with offset 800 * - 'F' For symbolic function descriptor pointers with offset
801 * - 'f' For simple symbolic function names without offset 801 * - 'f' For simple symbolic function names without offset
802 * - 'S' For symbolic direct pointers 802 * - 'S' For symbolic direct pointers with offset
803 * - 's' For symbolic direct pointers without offset
803 * - 'R' For a struct resource pointer, it prints the range of 804 * - 'R' For a struct resource pointer, it prints the range of
804 * addresses (not the name nor the flags) 805 * addresses (not the name nor the flags)
805 * - 'M' For a 6-byte MAC address, it prints the address in the 806 * - 'M' For a 6-byte MAC address, it prints the address in the
@@ -827,6 +828,7 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr,
827 case 'F': 828 case 'F':
828 case 'f': 829 case 'f':
829 ptr = dereference_function_descriptor(ptr); 830 ptr = dereference_function_descriptor(ptr);
831 case 's':
830 /* Fallthrough */ 832 /* Fallthrough */
831 case 'S': 833 case 'S':
832 return symbol_string(buf, end, ptr, spec, *fmt); 834 return symbol_string(buf, end, ptr, spec, *fmt);
@@ -1068,10 +1070,12 @@ qualifier:
1068 * @args: Arguments for the format string 1070 * @args: Arguments for the format string
1069 * 1071 *
1070 * This function follows C99 vsnprintf, but has some extensions: 1072 * This function follows C99 vsnprintf, but has some extensions:
1071 * %pS output the name of a text symbol 1073 * %pS output the name of a text symbol with offset
1074 * %ps output the name of a text symbol without offset
1072 * %pF output the name of a function pointer with its offset 1075 * %pF output the name of a function pointer with its offset
1073 * %pf output the name of a function pointer without its offset 1076 * %pf output the name of a function pointer without its offset
1074 * %pR output the address range in a struct resource 1077 * %pR output the address range in a struct resource
1078 * %n is ignored
1075 * 1079 *
1076 * The return value is the number of characters which would 1080 * The return value is the number of characters which would
1077 * be generated for the given input, excluding the trailing 1081 * be generated for the given input, excluding the trailing
@@ -1093,13 +1097,8 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
1093 1097
1094 /* Reject out-of-range values early. Large positive sizes are 1098 /* Reject out-of-range values early. Large positive sizes are
1095 used for unknown buffer sizes. */ 1099 used for unknown buffer sizes. */
1096 if (unlikely((int) size < 0)) { 1100 if (WARN_ON_ONCE((int) size < 0))
1097 /* There can be only one.. */
1098 static char warn = 1;
1099 WARN_ON(warn);
1100 warn = 0;
1101 return 0; 1101 return 0;
1102 }
1103 1102
1104 str = buf; 1103 str = buf;
1105 end = buf + size; 1104 end = buf + size;
@@ -1527,11 +1526,7 @@ EXPORT_SYMBOL_GPL(vbin_printf);
1527 * a binary buffer that generated by vbin_printf. 1526 * a binary buffer that generated by vbin_printf.
1528 * 1527 *
1529 * The format follows C99 vsnprintf, but has some extensions: 1528 * The format follows C99 vsnprintf, but has some extensions:
1530 * %pS output the name of a text symbol 1529 * see vsnprintf comment for details.
1531 * %pF output the name of a function pointer with its offset
1532 * %pf output the name of a function pointer without its offset
1533 * %pR output the address range in a struct resource
1534 * %n is ignored
1535 * 1530 *
1536 * The return value is the number of characters which would 1531 * The return value is the number of characters which would
1537 * be generated for the given input, excluding the trailing 1532 * be generated for the given input, excluding the trailing
@@ -1549,13 +1544,8 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf)
1549 1544
1550 struct printf_spec spec = {0}; 1545 struct printf_spec spec = {0};
1551 1546
1552 if (unlikely((int) size < 0)) { 1547 if (WARN_ON_ONCE((int) size < 0))
1553 /* There can be only one.. */
1554 static char warn = 1;
1555 WARN_ON(warn);
1556 warn = 0;
1557 return 0; 1548 return 0;
1558 }
1559 1549
1560 str = buf; 1550 str = buf;
1561 end = buf + size; 1551 end = buf + size;