]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
term/serial: Replace usage of memcmp() with strncmp()
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 23 Dec 2022 01:48:47 +0000 (12:48 +1100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 19 Jan 2023 16:39:04 +0000 (17:39 +0100)
We are comparing strings after all.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/term/serial.c

index 595e74b161c38bb8784ae085be00c153d5d870b4..6e9483cb871033ba7d82a9e9c3c7de5751337caf 100644 (file)
@@ -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],
@@ -245,7 +245,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)