Module Name: src
Committed By: mlelstv
Date: Sat Apr 12 07:30:01 UTC 2025
Modified Files:
src/sys/dev: ld.c
Log Message:
ld sc_dump backend takes an 'int' as disk address, fail when the
disk address is outside the possible range of an int.
To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/dev/ld.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/ld.c
diff -u src/sys/dev/ld.c:1.114 src/sys/dev/ld.c:1.115
--- src/sys/dev/ld.c:1.114 Wed Mar 5 00:41:17 2025
+++ src/sys/dev/ld.c Sat Apr 12 07:30:01 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: ld.c,v 1.114 2025/03/05 00:41:17 jakllsch Exp $ */
+/* $NetBSD: ld.c,v 1.115 2025/04/12 07:30:01 mlelstv Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.114 2025/03/05 00:41:17
jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ld.c,v 1.115 2025/04/12 07:30:01 mlelstv
Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -603,6 +603,12 @@ ld_dumpblocks(device_t dev, void *va, da
if (sc->sc_dump == NULL)
return (ENODEV);
+ /*
+ * sc_dump takes only an 'int' as a disk address
+ */
+ if (blkno < 0 || blkno + nblk - 1 > INT_MAX)
+ return (EIO);
+
return (*sc->sc_dump)(sc, va, blkno, nblk);
}