[bug report] dm: introduce zone append emulation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Damien Le Moal,

The patch bb37d77239af: "dm: introduce zone append emulation" from
May 26, 2021, leads to the following static checker warning:

	drivers/md/dm-zone.c:207 dm_zone_revalidate_cb()
	error: kvmalloc() only makes sense with GFP_KERNEL

drivers/md/dm-zone.c
   179  static int dm_zone_revalidate_cb(struct blk_zone *zone, unsigned int idx,
   180                                   void *data)
   181  {
   182          struct mapped_device *md = data;
   183          struct request_queue *q = md->queue;
   184  
   185          switch (zone->type) {
   186          case BLK_ZONE_TYPE_CONVENTIONAL:
   187                  if (!q->conv_zones_bitmap) {
   188                          q->conv_zones_bitmap =
   189                                  kcalloc(BITS_TO_LONGS(q->nr_zones),
   190                                          sizeof(unsigned long), GFP_NOIO);
   191                          if (!q->conv_zones_bitmap)
   192                                  return -ENOMEM;
   193                  }
   194                  set_bit(idx, q->conv_zones_bitmap);
   195                  break;
   196          case BLK_ZONE_TYPE_SEQWRITE_REQ:
   197          case BLK_ZONE_TYPE_SEQWRITE_PREF:
   198                  if (!q->seq_zones_wlock) {
   199                          q->seq_zones_wlock =
   200                                  kcalloc(BITS_TO_LONGS(q->nr_zones),
   201                                          sizeof(unsigned long), GFP_NOIO);
   202                          if (!q->seq_zones_wlock)
   203                                  return -ENOMEM;
   204                  }
   205                  if (!md->zwp_offset) {
   206                          md->zwp_offset =
   207                                  kvcalloc(q->nr_zones, sizeof(unsigned int),
   208                                           GFP_NOIO);

kvcalloc() does not respect the GFP_NOIO flag.

   209                          if (!md->zwp_offset)
   210                                  return -ENOMEM;
   211                  }
   212                  md->zwp_offset[idx] = dm_get_zone_wp_offset(zone);
   213  
   214                  break;
   215          default:
   216                  DMERR("Invalid zone type 0x%x at sectors %llu",
   217                        (int)zone->type, zone->start);
   218                  return -ENODEV;
   219          }
   220  
   221          return 0;
   222  }

regards,
dan carpenter

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/dm-devel




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux