diff options
author | Christoph Hellwig <hch@lst.de> | 2021-02-02 18:19:24 +0100 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-02-08 08:33:16 -0700 |
commit | 0f2e6ab851ae146c468bc5151c302c6e2473f70a (patch) | |
tree | 740ef403c488f74f65f71b838df33970c4244433 /include/linux/bio.h | |
parent | de76fd893074ab2cea132c28ac9efd9d0434215e (diff) | |
download | lwn-0f2e6ab851ae146c468bc5151c302c6e2473f70a.tar.gz lwn-0f2e6ab851ae146c468bc5151c302c6e2473f70a.zip |
block: turn the nr_iovecs argument to bio_alloc* into an unsigned short
The bi_max_vecs and bi_vcnt fields are defined as unsigned short, so
don't allow passing larger values in.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/bio.h')
-rw-r--r-- | include/linux/bio.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/bio.h b/include/linux/bio.h index 4a84207dd996..9ceeb8ecdb7f 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -407,8 +407,9 @@ extern void bioset_exit(struct bio_set *); extern int biovec_init_pool(mempool_t *pool, int pool_entries); extern int bioset_init_from_src(struct bio_set *bs, struct bio_set *src); -extern struct bio *bio_alloc_bioset(gfp_t, unsigned int, struct bio_set *); -struct bio *bio_kmalloc(gfp_t gfp_mask, unsigned int nr_iovecs); +struct bio *bio_alloc_bioset(gfp_t gfp, unsigned short nr_iovecs, + struct bio_set *bs); +struct bio *bio_kmalloc(gfp_t gfp_mask, unsigned short nr_iovecs); extern void bio_put(struct bio *); extern void __bio_clone_fast(struct bio *, struct bio *); @@ -416,7 +417,7 @@ extern struct bio *bio_clone_fast(struct bio *, gfp_t, struct bio_set *); extern struct bio_set fs_bio_set; -static inline struct bio *bio_alloc(gfp_t gfp_mask, unsigned int nr_iovecs) +static inline struct bio *bio_alloc(gfp_t gfp_mask, unsigned short nr_iovecs) { return bio_alloc_bioset(gfp_mask, nr_iovecs, &fs_bio_set); } |