Module Name: src Committed By: mrg Date: Tue Aug 1 07:58:41 UTC 2023
Modified Files: src/sys/arch/xen/xenbus: xenbus_probe.c src/sys/dev/ata: ata_raid_adaptec.c ata_raid_intel.c ata_raid_jmicron.c Log Message: don't test arrays against NULL. found by GCC 12. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/arch/xen/xenbus/xenbus_probe.c cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ata/ata_raid_adaptec.c cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ata/ata_raid_intel.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ata/ata_raid_jmicron.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/xen/xenbus/xenbus_probe.c diff -u src/sys/arch/xen/xenbus/xenbus_probe.c:1.58 src/sys/arch/xen/xenbus/xenbus_probe.c:1.59 --- src/sys/arch/xen/xenbus/xenbus_probe.c:1.58 Sat Aug 7 16:19:08 2021 +++ src/sys/arch/xen/xenbus/xenbus_probe.c Tue Aug 1 07:58:41 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: xenbus_probe.c,v 1.58 2021/08/07 16:19:08 thorpej Exp $ */ +/* $NetBSD: xenbus_probe.c,v 1.59 2023/08/01 07:58:41 mrg Exp $ */ /****************************************************************************** * Talks to Xen Store to figure out what devices we have. * @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.58 2021/08/07 16:19:08 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.59 2023/08/01 07:58:41 mrg Exp $"); #if 0 #define DPRINTK(fmt, args...) \ @@ -247,8 +247,7 @@ otherend_changed(struct xenbus_watch *wa /* Protect us against watches firing on old details when the otherend details change, say immediately after a resume. */ - if (!xdev->xbusd_otherend || - strncmp(xdev->xbusd_otherend, vec[XS_WATCH_PATH], + if (strncmp(xdev->xbusd_otherend, vec[XS_WATCH_PATH], strlen(xdev->xbusd_otherend))) { DPRINTK("Ignoring watch at %s", vec[XS_WATCH_PATH]); return; Index: src/sys/dev/ata/ata_raid_adaptec.c diff -u src/sys/dev/ata/ata_raid_adaptec.c:1.12 src/sys/dev/ata/ata_raid_adaptec.c:1.13 --- src/sys/dev/ata/ata_raid_adaptec.c:1.12 Sat Mar 19 13:51:01 2022 +++ src/sys/dev/ata/ata_raid_adaptec.c Tue Aug 1 07:58:41 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ata_raid_adaptec.c,v 1.12 2022/03/19 13:51:01 hannken Exp $ */ +/* $NetBSD: ata_raid_adaptec.c,v 1.13 2023/08/01 07:58:41 mrg Exp $ */ /*- * Copyright (c) 2000,2001,2002 Søren Schmidt <s...@freebsd.org> @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ata_raid_adaptec.c,v 1.12 2022/03/19 13:51:01 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ata_raid_adaptec.c,v 1.13 2023/08/01 07:58:41 mrg Exp $"); #include <sys/param.h> #include <sys/buf.h> @@ -161,9 +161,8 @@ ata_raid_read_config_adaptec(struct wd_s aai->aai_cylinders = aai->aai_capacity / (63 * 255); aai->aai_offset = 0; aai->aai_reserved = 17; - if (info->configs[0].name) - strlcpy(aai->aai_name, info->configs[0].name, - sizeof(aai->aai_name)); + strlcpy(aai->aai_name, info->configs[0].name, + sizeof(aai->aai_name)); /* XXX - bogus. RAID1 shouldn't really have an interleave */ if (aai->aai_interleave == 0) Index: src/sys/dev/ata/ata_raid_intel.c diff -u src/sys/dev/ata/ata_raid_intel.c:1.11 src/sys/dev/ata/ata_raid_intel.c:1.12 --- src/sys/dev/ata/ata_raid_intel.c:1.11 Sat Mar 19 13:51:01 2022 +++ src/sys/dev/ata/ata_raid_intel.c Tue Aug 1 07:58:41 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ata_raid_intel.c,v 1.11 2022/03/19 13:51:01 hannken Exp $ */ +/* $NetBSD: ata_raid_intel.c,v 1.12 2023/08/01 07:58:41 mrg Exp $ */ /*- * Copyright (c) 2000-2008 Søren Schmidt <s...@freebsd.org> @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ata_raid_intel.c,v 1.11 2022/03/19 13:51:01 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ata_raid_intel.c,v 1.12 2023/08/01 07:58:41 mrg Exp $"); #include <sys/param.h> #include <sys/buf.h> @@ -262,8 +262,7 @@ findvol: aai->aai_capacity / (aai->aai_heads * aai->aai_sectors); aai->aai_offset = map->offset; aai->aai_reserved = 3; - if (map->name) - strlcpy(aai->aai_name, map->name, sizeof(aai->aai_name)); + strlcpy(aai->aai_name, map->name, sizeof(aai->aai_name)); /* Fill in disk info */ diskidx = aai->aai_curdisk++; Index: src/sys/dev/ata/ata_raid_jmicron.c diff -u src/sys/dev/ata/ata_raid_jmicron.c:1.8 src/sys/dev/ata/ata_raid_jmicron.c:1.9 --- src/sys/dev/ata/ata_raid_jmicron.c:1.8 Sat Mar 19 13:51:01 2022 +++ src/sys/dev/ata/ata_raid_jmicron.c Tue Aug 1 07:58:41 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ata_raid_jmicron.c,v 1.8 2022/03/19 13:51:01 hannken Exp $ */ +/* $NetBSD: ata_raid_jmicron.c,v 1.9 2023/08/01 07:58:41 mrg Exp $ */ /*- * Copyright (c) 2000-2008 Søren Schmidt <s...@freebsd.org> @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ata_raid_jmicron.c,v 1.8 2022/03/19 13:51:01 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ata_raid_jmicron.c,v 1.9 2023/08/01 07:58:41 mrg Exp $"); #include <sys/param.h> #include <sys/buf.h> @@ -241,8 +241,7 @@ ata_raid_read_config_jmicron(struct wd_s aai->aai_capacity / (aai->aai_heads * aai->aai_sectors); aai->aai_offset = info->offset * 16; aai->aai_reserved = 2; - if (info->name) - strlcpy(aai->aai_name, info->name, sizeof(aai->aai_name)); + strlcpy(aai->aai_name, info->name, sizeof(aai->aai_name)); atabus = device_private(device_parent(dksc->sc_dev)); drive = atabus->sc_chan->ch_channel;