Skip to contentSkip to conversation

dm: add emulated block size target

bug report Dan Carpenter 2 participants 2 messages Apr 29, 2020 Device mapper

lore
Share & tools
lore
#0 lore raw

Hello Heinz Mauelshagen,

The patch d3d11ad3d087: "dm: add emulated block size target" from Mar 9, 2020, leads to the following static checker warning:

	drivers/md/dm-ebs-target.c:190 __ebs_process_bios()
	warn: assigning signed to unsigned: 'bio->bi_status = r' '(-4095)-0'

drivers/md/dm-ebs-target.c
173 if (__block_mod(bio_end_sector(bio), ec->u_bs) && block2 != block1)
174 dm_bufio_prefetch(ec->bufio, block2, 1);
175 }
176 }
177
178 bio_list_for_each(bio, &bios) {
179 r = -EIO;
180 if (bio_op(bio) == REQ_OP_READ)
181 r = __ebs_rw_bio(ec, READ, bio);
182 else if (bio_op(bio) == REQ_OP_WRITE) {
183 write = true;
184 r = __ebs_rw_bio(ec, WRITE, bio);
185 } else if (bio_op(bio) == REQ_OP_DISCARD) {
186 /* FIXME: (optionally) call dm_bufio_discard_buffers() once upstream. */
187 r = __ebs_forget_bio(ec, bio);
188 }
189

   190                  bio->bi_status = r;
                        ^^^^^^^^^^^^^^^^^^

"r" is a negative error code and ->bi_status is a u8 so this won't work.

191 }
192
193 /*

   194           * We write dirty buffers after processing I/O on them
   195           * but before we endio thus addressing REQ_FUA/REQ_SYNC.
   196           */

197 r = write ? dm_bufio_write_dirty_buffers(ec->bufio) : 0;

regards,
dan carpenter

#1 lore raw

Thanks for reporting this.

See patch to fix this submitted to dm-devel.

Heinz

Quoted 46 lines · Dan Carpenter

Hello Heinz Mauelshagen,

The patch d3d11ad3d087: "dm: add emulated block size target" from Mar 9, 2020, leads to the following static checker warning:

	drivers/md/dm-ebs-target.c:190 __ebs_process_bios()
	warn: assigning signed to unsigned: 'bio->bi_status = r' '(-4095)-0'

drivers/md/dm-ebs-target.c

    173                          if (__block_mod(bio_end_sector(bio), ec->u_bs) && block2 != block1)
    174                                  dm_bufio_prefetch(ec->bufio, block2, 1);
    175                  }
    176          }
    177
    178          bio_list_for_each(bio, &bios) {
    179                  r = -EIO;
    180                  if (bio_op(bio) == REQ_OP_READ)
    181                          r = __ebs_rw_bio(ec, READ, bio);
    182                  else if (bio_op(bio) == REQ_OP_WRITE) {
    183                          write = true;
    184                          r = __ebs_rw_bio(ec, WRITE, bio);
    185                  } else if (bio_op(bio) == REQ_OP_DISCARD) {
    186                          /* FIXME: (optionally) call dm_bufio_discard_buffers() once upstream. */
    187                          r = __ebs_forget_bio(ec, bio);
    188                  }
    189
    190                  bio->bi_status = r;
                         ^^^^^^^^^^^^^^^^^^

"r" is a negative error code and ->bi_status is a u8 so this won't work.

    191          }
    192
    193          /*
    194           * We write dirty buffers after processing I/O on them
    195           * but before we endio thus addressing REQ_FUA/REQ_SYNC.
    196           */
    197          r = write ? dm_bufio_write_dirty_buffers(ec->bufio) : 0;

regards,
dan carpenter

--
dm-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel