summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrg <mrg@NetBSD.org>2021-04-13 06:25:48 +0000
committermrg <mrg@NetBSD.org>2021-04-13 06:25:48 +0000
commit9940c1958fb790d5810b95a08724530f97a36fc8 (patch)
treefaf44fe79fafbfa387f30e303f46c5fe336ab00a
parent11d72a937db9cf97a5415017a7aaca306eec69ec (diff)
more GCC 10 fixes.
mDNSResponder: another wrong return local address dhcp: ignore a seemingly impossible stringop overflow hpacel: avoid maybe uninitialised error that is wrong. rsh: avoid impossible malloc(0) udf: cast pointers through (uintptr_t) to fool invalid boundary checks
-rw-r--r--external/apache2/mDNSResponder/usr.sbin/mdnsd/Makefile4
-rw-r--r--external/mpl/dhcp/bin/server/Makefile3
-rw-r--r--sbin/newfs_udf/udf_create.c10
-rw-r--r--sys/fs/udf/udf_subr.c11
-rw-r--r--sys/modules/hpacel/Makefile4
-rw-r--r--usr.bin/rsh/rsh.c6
6 files changed, 23 insertions, 15 deletions
diff --git a/external/apache2/mDNSResponder/usr.sbin/mdnsd/Makefile b/external/apache2/mDNSResponder/usr.sbin/mdnsd/Makefile
index 539b65201c9..9a6a027a254 100644
--- a/external/apache2/mDNSResponder/usr.sbin/mdnsd/Makefile
+++ b/external/apache2/mDNSResponder/usr.sbin/mdnsd/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.13 2020/09/06 07:20:26 mrg Exp $
+# $NetBSD: Makefile,v 1.14 2021/04/13 06:25:48 mrg Exp $
PROG= mdnsd
@@ -20,4 +20,6 @@ MAN= mdnsd.8
CWARNFLAGS.clang+= -Wno-unused-value -Wno-error=address-of-packed-member
CWARNFLAGS.gcc+= ${GCC_NO_ADDR_OF_PACKED_MEMBER}
+COPTS.DNSCommon.c+= ${GCC_NO_RETURN_LOCAL_ADDR}
+
.include <bsd.prog.mk>
diff --git a/external/mpl/dhcp/bin/server/Makefile b/external/mpl/dhcp/bin/server/Makefile
index 830168d6689..f0310509a51 100644
--- a/external/mpl/dhcp/bin/server/Makefile
+++ b/external/mpl/dhcp/bin/server/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2020/06/07 23:29:16 fox Exp $
+# $NetBSD: Makefile,v 1.7 2021/04/13 06:25:48 mrg Exp $
.include <bsd.own.mk>
@@ -22,5 +22,6 @@ COPTS.ddns.c +=-Wno-stringop-overflow
COPTS.mdb6.c += ${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} == 8:? -Wno-error=format-overflow :}
COPTS.omapi.c += -Wno-stack-protector
COPTS.confpars.c+= ${GCC_NO_STRINGOP_TRUNCATION}
+COPTS.mdb6.c+= ${GCC_NO_STRINGOP_OVERFLOW}
.include <bsd.prog.mk>
diff --git a/sbin/newfs_udf/udf_create.c b/sbin/newfs_udf/udf_create.c
index 81708d1668f..e26b4f7198d 100644
--- a/sbin/newfs_udf/udf_create.c
+++ b/sbin/newfs_udf/udf_create.c
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_create.c,v 1.28 2020/05/14 08:34:18 msaitoh Exp $ */
+/* $NetBSD: udf_create.c,v 1.29 2021/04/13 06:25:48 mrg Exp $ */
/*
* Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -30,7 +30,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: udf_create.c,v 1.28 2020/05/14 08:34:18 msaitoh Exp $");
+__RCSID("$NetBSD: udf_create.c,v 1.29 2021/04/13 06:25:48 mrg Exp $");
#include <stdio.h>
#include <stdlib.h>
@@ -2025,7 +2025,7 @@ udf_append_meta_mapping_part_to_efe(struct extfile_entry *efe,
uint64_t inf_len, obj_size, logblks_rec;
uint32_t l_ad, l_ea;
uint16_t crclen;
- uint8_t *bpos;
+ uintptr_t bpos;
inf_len = udf_rw64(efe->inf_len);
obj_size = udf_rw64(efe->obj_size);
@@ -2039,8 +2039,8 @@ udf_append_meta_mapping_part_to_efe(struct extfile_entry *efe,
icb->flags = udf_rw16(UDF_ICB_SHORT_ALLOC);
/* append short_ad */
- bpos = (uint8_t *) efe->data + l_ea + l_ad;
- memcpy(bpos, mapping, sizeof(struct short_ad));
+ bpos = (uintptr_t)efe->data + l_ea + l_ad;
+ memcpy((void *)bpos, mapping, sizeof(struct short_ad));
l_ad += sizeof(struct short_ad);
crclen += sizeof(struct short_ad);
diff --git a/sys/fs/udf/udf_subr.c b/sys/fs/udf/udf_subr.c
index 19ad2d7d4e0..0bf206081e1 100644
--- a/sys/fs/udf/udf_subr.c
+++ b/sys/fs/udf/udf_subr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_subr.c,v 1.152 2021/01/11 22:02:28 skrll Exp $ */
+/* $NetBSD: udf_subr.c,v 1.153 2021/04/13 06:25:49 mrg Exp $ */
/*
* Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.152 2021/01/11 22:02:28 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.153 2021/04/13 06:25:49 mrg Exp $");
#endif /* not lint */
@@ -2664,7 +2664,8 @@ udf_update_vat_extattr_from_lvid(struct udf_node *vat_node)
const char *extstr = "*UDF VAT LVExtension";
uint64_t vat_uniqueid;
uint32_t offset, a_l;
- uint8_t *ea_start, *lvextpos;
+ uint8_t *ea_start;
+ uintptr_t lvextpos;
int error;
/* get mountpoint and lvinfo */
@@ -2700,14 +2701,14 @@ udf_update_vat_extattr_from_lvid(struct udf_node *vat_node)
* copy first to avoid panics on some machines (!!)
*/
DPRINTF(VOLUMES, ("Updating VAT LVExtension attr\n"));
- lvextpos = implext->data + udf_rw32(implext->iu_l);
+ lvextpos = (uintptr_t)implext->data + udf_rw32(implext->iu_l);
lvext.unique_id_chk = vat_uniqueid;
lvext.num_files = lvinfo->num_files;
lvext.num_directories = lvinfo->num_directories;
memmove(lvext.logvol_id, ump->logical_vol->logvol_id, 128);
- memcpy(lvextpos, &lvext, sizeof(lvext));
+ memcpy((void *)lvextpos, &lvext, sizeof(lvext));
return 0;
}
diff --git a/sys/modules/hpacel/Makefile b/sys/modules/hpacel/Makefile
index 78a0128e4a3..b898871083c 100644
--- a/sys/modules/hpacel/Makefile
+++ b/sys/modules/hpacel/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.2 2019/02/17 04:05:50 rin Exp $
+# $NetBSD: Makefile,v 1.3 2021/04/13 06:25:49 mrg Exp $
.include "../Makefile.inc"
@@ -8,4 +8,6 @@ KMOD= hpacel
IOCONF= hpacel.ioconf
SRCS= hpacel_acpi.c
+COPTS.hpacel_acpi.c+= ${GCC_NO_MAYBE_UNINITIALIZED}
+
.include <bsd.kmodule.mk>
diff --git a/usr.bin/rsh/rsh.c b/usr.bin/rsh/rsh.c
index 30f340a818c..c6c6424046d 100644
--- a/usr.bin/rsh/rsh.c
+++ b/usr.bin/rsh/rsh.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rsh.c,v 1.38 2014/11/26 23:44:21 enami Exp $ */
+/* $NetBSD: rsh.c,v 1.39 2021/04/13 06:25:49 mrg Exp $ */
/*-
* Copyright (c) 1983, 1990, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1990, 1993, 1994\
#if 0
static char sccsid[] = "@(#)rsh.c 8.4 (Berkeley) 4/29/95";
#else
-__RCSID("$NetBSD: rsh.c,v 1.38 2014/11/26 23:44:21 enami Exp $");
+__RCSID("$NetBSD: rsh.c,v 1.39 2021/04/13 06:25:49 mrg Exp $");
#endif
#endif /* not lint */
@@ -454,6 +454,8 @@ copyargs(char **argv)
cc = 0;
for (ap = argv; *ap; ++ap)
cc += strlen(*ap) + 1;
+ if (cc == 0)
+ usage();
if (!(args = malloc((u_int)cc)))
err(1, "malloc");
ep = args + cc;