Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

alpha: Replace strncmp with str_has_prefix

In commit b6b2735514bc
("tracing: Use str_has_prefix() instead of using fixed sizes")
the newly introduced str_has_prefix() was used
to replace error-prone strncmp(str, const, len).
Here fix codes with the same pattern.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: Matt Turner <mattst88@gmail.com>

authored by

Chuhong Yuan and committed by
Matt Turner
5f14596e 5bea3044

+2 -2
+1 -1
arch/alpha/boot/tools/objstrip.c
··· 148 148 #ifdef __ELF__ 149 149 elf = (struct elfhdr *) buf; 150 150 151 - if (elf->e_ident[0] == 0x7f && strncmp((char *)elf->e_ident + 1, "ELF", 3) == 0) { 151 + if (elf->e_ident[0] == 0x7f && str_has_prefix((char *)elf->e_ident + 1, "ELF")) { 152 152 if (elf->e_type != ET_EXEC) { 153 153 fprintf(stderr, "%s: %s is not an ELF executable\n", 154 154 prog_name, inname);
+1 -1
arch/alpha/kernel/setup.c
··· 474 474 #ifndef alpha_using_srm 475 475 /* Assume that we've booted from SRM if we haven't booted from MILO. 476 476 Detect the later by looking for "MILO" in the system serial nr. */ 477 - alpha_using_srm = strncmp((const char *)hwrpb->ssn, "MILO", 4) != 0; 477 + alpha_using_srm = !str_has_prefix((const char *)hwrpb->ssn, "MILO"); 478 478 #endif 479 479 #ifndef alpha_using_qemu 480 480 /* Similarly, look for QEMU. */