Module Name: src
Committed By: isaki
Date: Thu Jan 12 14:24:53 UTC 2017
Modified Files:
src/sys/arch/x68k/dev: fd.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/x68k/dev/fd.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/arch/x68k/dev/fd.c
diff -u src/sys/arch/x68k/dev/fd.c:1.118 src/sys/arch/x68k/dev/fd.c:1.119
--- src/sys/arch/x68k/dev/fd.c:1.118 Sat Jul 11 10:32:46 2015
+++ src/sys/arch/x68k/dev/fd.c Thu Jan 12 14:24:53 2017
@@ -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 @@ fd_dev_to_type(struct fd_softc *fd, dev_
{
size_t type = FDTYPE(dev);
- if (type > __arraycount(fd_types))
+ if (type >= __arraycount(fd_types))
return NULL;
return &fd_types[type];
}