From: Eric Sesterhenn Date: Fri, 28 Apr 2006 01:39:20 +0000 (-0700) Subject: [PATCH] fix array overrun in drivers/char/mwave/mwavedd.c X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d698f1c72629ff43d0cb6b9f1d17c491c057a0d9;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [PATCH] fix array overrun in drivers/char/mwave/mwavedd.c this fixes coverity id #489. Since the last element in the array is always ARRAY_SIZE-1 we have to check for ipcnum >= ARRAY_SIZE() Signed-off-by: Eric Sesterhenn Signed-off-by: Adrian Bunk Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/char/mwave/mwavedd.c b/drivers/char/mwave/mwavedd.c index 8666171e187b..d3ba2f860ef0 100644 --- a/drivers/char/mwave/mwavedd.c +++ b/drivers/char/mwave/mwavedd.c @@ -271,7 +271,7 @@ static int mwave_ioctl(struct inode *inode, struct file *file, 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_REGISTER_IPC:"