orangefs: silence harmless integer overflow warning
commiteb82fbcf82965c18da11ada92b82f1400b36e0ad
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 21 Jan 2017 05:04:45 +0000 (21 08:04 +0300)
committerMike Marshall <hubcap@omnibond.com>
Fri, 3 Feb 2017 19:37:15 +0000 (3 14:37 -0500)
tree6e40ff6afa5d91a42ec79f4a9390d304c0e7d547
parenta1f817dc8ed79cdff2b76bc51d545fb9465982be
orangefs: silence harmless integer overflow warning

The issue here is that in orangefs_bufmap_alloc() we do:

bufmap->buffer_index_array =
kzalloc(DIV_ROUND_UP(bufmap->desc_count, BITS_PER_LONG), GFP_KERNEL);

If we choose a bufmap->desc_count like -31 then it means the
DIV_ROUND_UP ends up having an integer overflow.   The result is that
kzalloc() returns the ZERO_SIZE_PTR and there is a static checker
warning.

But this bug is harmless because on the next lines we use ->desc_count
to do a kcalloc().  That has integer overflow checking built in so the
kcalloc() fails and we return an error code.

Anyway, it doesn't make sense to talk about negative sizes and blocking
them silences the static checker warning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
fs/orangefs/orangefs-bufmap.c