Commit 121f099412bd6576dfb3d94222e89d9341362177

Authored by Dan Carpenter
Committed by Jens Axboe
1 parent 3540d5e89b

bio: change some signed vars to unsigned

This is just a cleanup patch to silence a static checker warning.

The problem is that we cap "nr_iovecs" so it can't be larger than
"UIO_MAXIOV" but we don't check for negative values.  It turns out this is
prevented at other layers, but logically it doesn't make sense to have
negative nr_iovecs so making it unsigned is nicer.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

Showing 2 changed files with 6 additions and 5 deletions Side-by-side Diff

... ... @@ -337,7 +337,7 @@
337 337 * RETURNS:
338 338 * Pointer to new bio on success, NULL on failure.
339 339 */
340   -struct bio *bio_alloc(gfp_t gfp_mask, int nr_iovecs)
  340 +struct bio *bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs)
341 341 {
342 342 struct bio *bio = bio_alloc_bioset(gfp_mask, nr_iovecs, fs_bio_set);
343 343  
... ... @@ -365,7 +365,7 @@
365 365 * %__GFP_WAIT, the allocation is guaranteed to succeed.
366 366 *
367 367 **/
368   -struct bio *bio_kmalloc(gfp_t gfp_mask, int nr_iovecs)
  368 +struct bio *bio_kmalloc(gfp_t gfp_mask, unsigned int nr_iovecs)
369 369 {
370 370 struct bio *bio;
371 371  
... ... @@ -696,7 +696,8 @@
696 696 kfree(bmd);
697 697 }
698 698  
699   -static struct bio_map_data *bio_alloc_map_data(int nr_segs, int iov_count,
  699 +static struct bio_map_data *bio_alloc_map_data(int nr_segs,
  700 + unsigned int iov_count,
700 701 gfp_t gfp_mask)
701 702 {
702 703 struct bio_map_data *bmd;
... ... @@ -211,8 +211,8 @@
211 211 extern struct bio_set *bioset_create(unsigned int, unsigned int);
212 212 extern void bioset_free(struct bio_set *);
213 213  
214   -extern struct bio *bio_alloc(gfp_t, int);
215   -extern struct bio *bio_kmalloc(gfp_t, int);
  214 +extern struct bio *bio_alloc(gfp_t, unsigned int);
  215 +extern struct bio *bio_kmalloc(gfp_t, unsigned int);
216 216 extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *);
217 217 extern void bio_put(struct bio *);
218 218 extern void bio_free(struct bio *, struct bio_set *);