Module Name: src
Committed By: mlelstv
Date: Tue Aug 18 21:26:16 UTC 2015
Modified Files:
src/sys/dev: dksubr.c
Log Message:
only touch b_resid on error.
To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/dksubr.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/dev/dksubr.c
diff -u src/sys/dev/dksubr.c:1.71 src/sys/dev/dksubr.c:1.72
--- src/sys/dev/dksubr.c:1.71 Sun Aug 16 18:00:03 2015
+++ src/sys/dev/dksubr.c Tue Aug 18 21:26:16 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.71 2015/08/16 18:00:03 mlelstv Exp $ */
+/* $NetBSD: dksubr.c,v 1.72 2015/08/18 21:26:16 mlelstv 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.71 2015/08/16 18:00:03 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.72 2015/08/18 21:26:16 mlelstv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -220,26 +220,26 @@ dk_translate(struct dk_softc *dksc, stru
numsecs = dk->dk_geom.dg_secperunit;
secsize = dk->dk_geom.dg_secsize;
- bp->b_resid = bp->b_bcount;
-
/*
* The transfer must be a whole number of blocks and the offset must
* not be negative.
*/
- if ((bp->b_bcount % secsize) != 0 || bp->b_blkno < 0)
- return EINVAL;
+ if ((bp->b_bcount % secsize) != 0 || bp->b_blkno < 0) {
+ bp->b_error = EINVAL;
+ goto done;
+ }
/* If there is nothing to do, then we are done */
if (bp->b_bcount == 0)
- return 0;
+ goto done;
wlabel = dksc->sc_flags & (DKF_WLABEL|DKF_LABELLING);
if (part == RAW_PART) {
if (bounds_check_with_mediasize(bp, DEV_BSIZE, numsecs) <= 0)
- return bp->b_error;
+ goto done;
} else {
if (bounds_check_with_label(&dksc->sc_dkdev, bp, wlabel) <= 0)
- return bp->b_error;
+ goto done;
}
/*
@@ -256,6 +256,10 @@ dk_translate(struct dk_softc *dksc, stru
bp->b_rawblkno = blkno;
return -1;
+
+done:
+ bp->b_resid = bp->b_bcount;
+ return bp->b_error;
}
void