[bug report] dm verity: add support for forward error correction

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

 



Hello Sami Tolvanen,

The patch a739ff3f543a: "dm verity: add support for forward error
correction" from Dec 3, 2015, leads to the following static checker
warning:

	drivers/md/dm-verity-fec.c:147 fec_decode_bufs()
	warn: 'par' can also be NULL

drivers/md/dm-verity-fec.c
   128  static int fec_decode_bufs(struct dm_verity *v, struct dm_verity_fec_io *fio,
   129                             u64 rsb, int byte_index, unsigned block_offset,
   130                             int neras)
   131  {
   132          int r, corrected = 0, res;
   133          struct dm_buffer *buf;
   134          unsigned n, i, offset;
   135          u8 *par, *block;
   136  
   137          par = fec_read_parity(v, rsb, block_offset, &offset, &buf);
   138          if (IS_ERR(par))
   139                  return PTR_ERR(par);

Apparently, if the read is a blocking read then new_read() returns NULL.
The documentation is unclear (just joking, there is no documentation).

   140  
   141          /*
   142           * Decode the RS blocks we have in bufs. Each RS block results in
   143           * one corrected target byte and consumes fec->roots parity bytes.
   144           */
   145          fec_for_each_buffer_rs_block(fio, n, i) {
   146                  block = fec_buffer_rs_block(v, fio, n, i);
   147                  res = fec_decode_rs8(v, fio, block, &par[offset], neras);
   148                  if (res < 0) {
   149                          r = res;
   150                          goto error;
   151                  }
   152  
   153                  corrected += res;
   154                  fio->output[block_offset] = block[byte_index];
   155  
   156                  block_offset++;
   157                  if (block_offset >= 1 << v->data_dev_block_bits)
   158                          goto done;
   159  
   160                  /* read the next block when we run out of parity bytes */
   161                  offset += v->fec->roots;
   162                  if (offset >= 1 << v->data_dev_block_bits) {
   163                          dm_bufio_release(buf);
   164  
   165                          par = fec_read_parity(v, rsb, block_offset, &offset, &buf);
   166                          if (unlikely(IS_ERR(par)))
   167                                  return PTR_ERR(par);
   168                  }
   169          }
   170  done:
   171          r = corrected;

regards,
dan carpenter

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.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