aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/debug.c
diff options
context:
space:
mode:
authorJesper Juhl <jesper.juhl@gmail.com>2007-08-04 01:25:26 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-10-14 13:10:20 +0300
commit0169b49d52400a6035cd0f2ccd08bcba061a1a9b (patch)
tree534643ffe146db43ece0ce2476c2da919408bce5 /drivers/mtd/ubi/debug.c
parentUBI: add more prints (diff)
downloadlinux-dev-0169b49d52400a6035cd0f2ccd08bcba061a1a9b.tar.xz
linux-dev-0169b49d52400a6035cd0f2ccd08bcba061a1a9b.zip
UBI: don't use array index before testing if it is negative
I can't find anything guaranteeing that 'ubi_num' cannot be <0 in drivers/mtd/ubi/kapi.c::ubi_open_volume(), and in fact the code even tests for that and errors out if so. Unfortunately the test for "ubi_num < 0" happens after we've already used 'ubi_num' as an array index - bad thing to do if it is negative. This patch moves the test earlier in the function and then moves the indexing using that variable after the check. A bit safer :-) Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/debug.c')
0 files changed, 0 insertions, 0 deletions