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
thorpej-i2c-spi-conf
mrg 2021-04-13 06:25:48 +00:00
parent 6274000239
commit 97b36aa771
6 changed files with 23 additions and 15 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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);

View File

@ -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;
}

View File

@ -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>

View File

@ -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;