[v1,1/1] lib/vsprintf: Use isodigit() for the octal number check

Message ID 20230327142721.48378-1-andriy.shevchenko@linux.intel.com
State New
Headers
Series [v1,1/1] lib/vsprintf: Use isodigit() for the octal number check |

Commit Message

Andy Shevchenko March 27, 2023, 2:27 p.m. UTC
  Use isodigit() to test the octal number instead of homegrown approach.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 lib/vsprintf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Sergey Senozhatsky March 28, 2023, 1:36 a.m. UTC | #1
On (23/03/27 17:27), Andy Shevchenko wrote:
> 
> Use isodigit() to test the octal number instead of homegrown approach.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

FWIW
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
  
Petr Mladek March 28, 2023, 8:43 a.m. UTC | #2
On Mon 2023-03-27 17:27:21, Andy Shevchenko wrote:
> Use isodigit() to test the octal number instead of homegrown approach.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr
  
Petr Mladek April 3, 2023, 10:39 a.m. UTC | #3
On Mon 2023-03-27 17:27:21, Andy Shevchenko wrote:
> Use isodigit() to test the octal number instead of homegrown approach.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

JFYI, the patch has been committed into printk/linux.git,
branch for-6.4.

Best Regards,
Petr
  

Patch

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index fbe320b5e89f..40f560959b16 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -3642,7 +3642,7 @@  int vsscanf(const char *buf, const char *fmt, va_list args)
 		if (!digit
 		    || (base == 16 && !isxdigit(digit))
 		    || (base == 10 && !isdigit(digit))
-		    || (base == 8 && (!isdigit(digit) || digit > '7'))
+		    || (base == 8 && !isodigit(digit))
 		    || (base == 0 && !isdigit(digit)))
 			break;