]> git.karo-electronics.de Git - karo-tx-linux.git/commit
dm raid: fix a couple integer overflows
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 29 May 2014 08:23:23 +0000 (11:23 +0300)
committerMike Snitzer <snitzer@redhat.com>
Mon, 9 Feb 2015 18:06:48 +0000 (13:06 -0500)
commit3ca5a21a9c02bdebe2d95268482031f002efcf23
tree299c6cd87e488dc5f59449fc5dda1e68ed453007
parent65803c2059832fb99b992728157f7924c2e42d4b
dm raid: fix a couple integer overflows

My static checker complains that if "num_raid_params" is UINT_MAX then
the "if (num_raid_params + 1 > argc) {" check doesn't work as intended.

The other change is that I moved the "if (argc != (num_raid_devs * 2))"
condition forward a few lines so it was before the call to
context_alloc().  If we had an integer overflow inside that function
then it would lead to an immediate crash.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-raid.c