From 93751117ed0116ff2fc892d28a1246771bedcf48 Mon Sep 17 00:00:00 2001 From: jsg Date: Sat, 13 Aug 2022 06:44:48 +0000 Subject: [PATCH] avoid uninitialised var when boot_unit has an unexpected value tested by and ok aoyama@ --- sys/arch/luna88k/luna88k/autoconf.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sys/arch/luna88k/luna88k/autoconf.c b/sys/arch/luna88k/luna88k/autoconf.c index e4b6c7c1fb3..c530c8802bb 100644 --- a/sys/arch/luna88k/luna88k/autoconf.c +++ b/sys/arch/luna88k/luna88k/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.24 2020/02/20 06:12:14 jsg Exp $ */ +/* $OpenBSD: autoconf.c,v 1.25 2022/08/13 06:44:48 jsg Exp $ */ /* * Copyright (c) 1998 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -130,12 +130,10 @@ get_autoboot_device(void) len = strlen(value); if (len == 1) { c = value[0]; - } else if (len == 2) { - if (value[0] == '1') { - /* External spc (spc1) */ - strlcpy(autoboot.cont, "spc1", sizeof(autoboot.cont)); - c = value[1]; - } + } else if (len == 2 && value[0] == '1') { + /* External spc (spc1) */ + strlcpy(autoboot.cont, "spc1", sizeof(autoboot.cont)); + c = value[1]; } else c = -1; -- 2.20.1