Skip to contentSkip to conversation

Merge branch 'for-next' of https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git

bug report Dan Carpenter 2 participants 2 messages Sep 21 – Sep 22 Block layer

lore
Share & tools
lore
#0 lore raw

Hello Mark Brown,

Commit a9ce2250a714 ("Merge branch 'for-next' of
https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git")
from Sep 18, 2026 (linux-next), leads to the following Smatch static checker warning:

	block/blk-zoned.c:2200 disk_init_revalidate_args()
	warn: impossible condition '(args->nr_zones > (~0)) => (0-u32max > u32max)'

block/blk-zoned.c

    2195 static int disk_init_revalidate_args(struct gendisk *disk,
    2196                                      struct blk_revalidate_zone_args *args)
    2197 {
    2198         args->disk = disk;
    2199         args->nr_zones = disk_get_nr_zones(disk, args->capacity);
--> 2200         if (args->nr_zones > UINT_MAX)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^

The linux-next merge for linux-block went a bit sideways and commit 7c431d61b69a ("scsi: block: Fix zones_cond out-of-bounds write on zone report") needs to be re-done.

    2201                 return -EINVAL;
    2202 
    2203         /* Cached zone conditions: 1 byte per zone */
    2204         args->zones_state = kzalloc(args->nr_zones, GFP_NOIO);
    2205         if (!args->zones_state)
    2206                 return -ENOMEM;
    2207 
    2208         return 0;
    2209 }

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter

#1 lore raw
Quoted 10 lines · Dan Carpenter

Hello Mark Brown,

Commit a9ce2250a714 ("Merge branch 'for-next' of
https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git")
from Sep 18, 2026 (linux-next), leads to the following Smatch static checker warning:

	block/blk-zoned.c:2200 disk_init_revalidate_args()
	warn: impossible condition '(args->nr_zones > (~0)) => (0-u32max > u32max)'
Quoted 8 lines

block/blk-zoned.c

    2195 static int disk_init_revalidate_args(struct gendisk *disk,
    2196                                      struct blk_revalidate_zone_args *args)
    2197 {
    2198         args->disk = disk;
    2199         args->nr_zones = disk_get_nr_zones(disk, args->capacity);
--> 2200         if (args->nr_zones > UINT_MAX)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^

This was fixed with an improved conflict resolution yesterday. Today's linux-next does not have this anymore, so this should now be all good.

Signature · 2 lines
Damien Le Moal
Western Digital Research