Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] drivers/mfd/sm501.c: fix an off-by-one

Fix an off-by-one spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Vincent Sanders <vince@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Adrian Bunk and committed by
Linus Torvalds
bf703c3f 10fa1155

+1 -1
+1 -1
drivers/mfd/sm501.c
··· 319 319 320 320 mode &= 3; /* get current power mode */ 321 321 322 - if (unit > ARRAY_SIZE(sm->unit_power)) { 322 + if (unit >= ARRAY_SIZE(sm->unit_power)) { 323 323 dev_err(dev, "%s: bad unit %d\n", __FUNCTION__, unit); 324 324 goto already; 325 325 }