diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2022-08-13 06:44:49 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2022-08-13 06:44:49 +0000 |
commit | 0f184174fabb71db976b1807affab294c4b80d9a (patch) | |
tree | a4499b12fbb97e0807dcacb1eb18528fcc4609e8 | |
parent | 1a6fc2367d94b1b4c456e205ab54169979ed379b (diff) |
avoid uninitialised var when boot_unit has an unexpected value
tested by and ok aoyama@
-rw-r--r-- | sys/arch/luna88k/luna88k/autoconf.c | 12 |
1 files 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; |