All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] scsi: sd_zbc: emulate ZONE_APPEND commands
@ 2021-02-16 19:39 Dan Carpenter
  2021-02-16 23:33 ` Damien Le Moal
  0 siblings, 1 reply; 14+ messages in thread
From: Dan Carpenter @ 2021-02-16 19:39 UTC (permalink / raw)
  To: johannes.thumshirn; +Cc: linux-scsi, Michal Hocko

Hello Johannes Thumshirn,

The patch 5795eb443060: "scsi: sd_zbc: emulate ZONE_APPEND commands"
from May 12, 2020, leads to the following static checker warning:

	drivers/scsi/sd_zbc.c:741 sd_zbc_revalidate_zones()
	error: kvmalloc() only makes sense with GFP_KERNEL

drivers/scsi/sd_zbc.c
   721          /*
   722           * There is nothing to do for regular disks, including host-aware disks
   723           * that have partitions.
   724           */
   725          if (!blk_queue_is_zoned(q))
   726                  return 0;
   727  
   728          /*
   729           * Make sure revalidate zones are serialized to ensure exclusive
   730           * updates of the scsi disk data.
   731           */
   732          mutex_lock(&sdkp->rev_mutex);
   733  
   734          if (sdkp->zone_blocks == zone_blocks &&
   735              sdkp->nr_zones == nr_zones &&
   736              disk->queue->nr_zones == nr_zones)
   737                  goto unlock;
   738  
   739          sdkp->zone_blocks = zone_blocks;
   740          sdkp->nr_zones = nr_zones;
   741          sdkp->rev_wp_offset = kvcalloc(nr_zones, sizeof(u32), GFP_NOIO);
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
We're passing GFP_NOIO here so it just defaults to kcalloc() and will
not vmalloc() the memory.

   742          if (!sdkp->rev_wp_offset) {
   743                  ret = -ENOMEM;
   744                  goto unlock;
   745          }
   746  
   747          ret = blk_revalidate_disk_zones(disk, sd_zbc_revalidate_zones_cb);
   748  

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-02-17 11:19 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-16 19:39 [bug report] scsi: sd_zbc: emulate ZONE_APPEND commands Dan Carpenter
2021-02-16 23:33 ` Damien Le Moal
2021-02-17  6:42   ` Johannes Thumshirn
2021-02-17  8:00     ` Damien Le Moal
2021-02-17  8:03     ` Michal Hocko
2021-02-17  9:08       ` Johannes Thumshirn
2021-02-17  9:36         ` Michal Hocko
2021-02-17  9:41           ` Johannes Thumshirn
2021-02-17 10:05             ` Michal Hocko
2021-02-17  9:13       ` Damien Le Moal
2021-02-17  9:18         ` Johannes Thumshirn
2021-02-17 11:16           ` Dan Carpenter
2021-02-17 11:18             ` Johannes Thumshirn
2021-02-17  9:32         ` Michal Hocko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.