Skip to contentSkip to conversation

Off-by-one in drivers/char/mwave/mwavedd.c

PATCH New Eric Sesterhenn 1 participant 1 message Sep 26, 2006 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Off-by-one in drivers/char/mwave/mwavedd.c

hi,

this fixes two off by ones in the mwave driver, found via find -iname \*.[ch] | xargs grep "> ARRAY_SIZE("

drivers/char/mwave/mwavedd.c renamed from drivers/char/mwave/mwavedd.c.orig +2 -2
@@ -297,7 +297,7 @@ static int mwave_ioctl(struct inode *ino
 				" ipcnum %x, usIntCount %x\n",
 				ipcnum,
 				pDrvData->IPCs[ipcnum].usIntCount);
-			if (ipcnum > ARRAY_SIZE(pDrvData->IPCs)) {
+			if (ipcnum >= ARRAY_SIZE(pDrvData->IPCs)) {
 				PRINTK_ERROR(KERN_ERR_MWAVE
 						"mwavedd::mwave_ioctl:"
 						" IOCTL_MW_GET_IPC: Error:"
@@ -355,7 +355,7 @@ static int mwave_ioctl(struct inode *ino
 				"mwavedd::mwave_ioctl IOCTL_MW_UNREGISTER_IPC"
 				" ipcnum %x\n",
 				ipcnum);
-			if (ipcnum > ARRAY_SIZE(pDrvData->IPCs)) {
+			if (ipcnum >= ARRAY_SIZE(pDrvData->IPCs)) {
 				PRINTK_ERROR(KERN_ERR_MWAVE
 						"mwavedd::mwave_ioctl:"
 						" IOCTL_MW_UNREGISTER_IPC:"