Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x68k/dev Fix the possibility of off-by-one on the g...
details: https://anonhg.NetBSD.org/src/rev/ee71de92ccbb
branches: trunk
changeset: 350472:ee71de92ccbb
user: isaki <isaki%NetBSD.org@localhost>
date: Thu Jan 12 14:24:53 2017 +0000
description:
Fix the possibility of off-by-one on the grammer. Reported by coypu.
Currently it never happens because type is (minor number % 7) and
the arraycount of fd_types[] is 8. I.e., it is a dead code...
However, when the capacity of the FDTYPE() changes or the arraycount
of fd_types[] changes, this correction will be effective.
diffstat:
sys/arch/x68k/dev/fd.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diffs (27 lines):
diff -r 1ea005b913b8 -r ee71de92ccbb sys/arch/x68k/dev/fd.c
--- a/sys/arch/x68k/dev/fd.c Thu Jan 12 13:53:11 2017 +0000
+++ b/sys/arch/x68k/dev/fd.c Thu Jan 12 14:24:53 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fd.c,v 1.118 2015/07/11 10:32:46 kamil Exp $ */
+/* $NetBSD: fd.c,v 1.119 2017/01/12 14:24:53 isaki Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.118 2015/07/11 10:32:46 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.119 2017/01/12 14:24:53 isaki Exp $");
#include "opt_ddb.h"
#include "opt_m68k_arch.h"
@@ -672,7 +672,7 @@
{
size_t type = FDTYPE(dev);
- if (type > __arraycount(fd_types))
+ if (type >= __arraycount(fd_types))
return NULL;
return &fd_types[type];
}
Home |
Main Index |
Thread Index |
Old Index