grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/3] serial: Replace usage of memcmp with strncmp


From: Benjamin Herrenschmidt
Subject: [PATCH 1/3] serial: Replace usage of memcmp with strncmp
Date: Fri, 23 Dec 2022 12:48:47 +1100

We are comparing strings after all

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 grub-core/term/serial.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/grub-core/term/serial.c b/grub-core/term/serial.c
index d161e1d36..88bcd4032 100644
--- a/grub-core/term/serial.c
+++ b/grub-core/term/serial.c
@@ -152,7 +152,7 @@ grub_serial_find (const char *name)
       break;
 
 #if (defined(__mips__) || defined (__i386__) || defined (__x86_64__)) && 
!defined(GRUB_MACHINE_EMU) && !defined(GRUB_MACHINE_ARC)
-  if (!port && grub_memcmp (name, "port", sizeof ("port") - 1) == 0
+  if (!port && grub_strncmp (name, "port", sizeof ("port") - 1) == 0
       && grub_isxdigit (name [sizeof ("port") - 1]))
     {
       name = grub_serial_ns8250_add_port (grub_strtoul (&name[sizeof ("port") 
- 1],
@@ -242,7 +242,7 @@ grub_serial_find (const char *name)
 #endif
 
 #ifdef GRUB_MACHINE_IEEE1275
-  if (!port && grub_memcmp (name, "ieee1275/", sizeof ("ieee1275/") - 1) == 0)
+  if (!port && grub_strncmp (name, "ieee1275/", sizeof ("ieee1275/") - 1) == 0)
     {
       name = grub_ofserial_add_port (&name[sizeof ("ieee1275/") - 1]);
       if (!name)
-- 
2.34.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]