Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Initialize error also in the case where len=0, which...
details: https://anonhg.NetBSD.org/src/rev/d079a9999229
branches: trunk
changeset: 355956:d079a9999229
user: maya <maya%NetBSD.org@localhost>
date: Thu Aug 24 11:26:32 2017 +0000
description:
Initialize error also in the case where len=0, which just succeeds.
while here, assert that the len is indeed non-negative. this is already
confirmed by sys_fdiscard, but let's be sure.
reported by: GCC, but with different compile flags
diffstat:
sys/dev/dksubr.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (30 lines):
diff -r 20e9d3ce6328 -r d079a9999229 sys/dev/dksubr.c
--- a/sys/dev/dksubr.c Thu Aug 24 10:43:42 2017 +0000
+++ b/sys/dev/dksubr.c Thu Aug 24 11:26:32 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.98 2017/08/13 22:23:16 mlelstv Exp $ */
+/* $NetBSD: dksubr.c,v 1.99 2017/08/24 11:26:32 maya Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.98 2017/08/13 22:23:16 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.99 2017/08/24 11:26:32 maya Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -497,7 +497,10 @@
const struct dkdriver *dkd = dksc->sc_dkdev.dk_driver;
unsigned secsize = dksc->sc_dkdev.dk_geom.dg_secsize;
struct buf tmp, *bp = &tmp;
- int maxsz, error;
+ int maxsz;
+ int error = 0;
+
+ KASSERT(len >= 0);
DPRINTF_FOLLOW(("%s(%s, %p, 0x"PRIx64", %jd, %jd)\n", __func__,
dksc->sc_xname, dksc, (intmax_t)pos, (intmax_t)len));
Home |
Main Index |
Thread Index |
Old Index