Linux Device Mapper development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: dm-devel@redhat.com
Cc: samitolvanen@google.com
Subject: [bug report] dm verity: add support for forward error correction
Date: Tue, 25 Sep 2018 15:07:06 +0300	[thread overview]
Message-ID: <20180925120706.GA29831@mwanda> (raw)

Hi DM devs,

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
   124  /*
   125   * Decode all RS blocks from buffers and copy corrected bytes into fio->output
   126   * starting from block_offset.
   127   */
   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))
                           ^^^

The problem is that fec_read_parity() returns NULL from new_read().
It's possible that this is intentional...  There isn't any documentation
but in my experience there never is so that doesn't necessarily mean
anything...

   139                  return PTR_ERR(par);
   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  

regards,
dan carpenter

             reply	other threads:[~2018-09-25 12:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25 12:07 Dan Carpenter [this message]
2018-09-25 16:03 ` [bug report] dm verity: add support for forward error correction Sami Tolvanen
2018-09-26 10:14   ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2018-06-14 14:33 Dan Carpenter
2018-06-14 15:54 ` Sami Tolvanen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180925120706.GA29831@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=dm-devel@redhat.com \
    --cc=samitolvanen@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox