* [bug report] dm verity: add support for forward error correction
@ 2018-09-25 12:07 Dan Carpenter
2018-09-25 16:03 ` Sami Tolvanen
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2018-09-25 12:07 UTC (permalink / raw)
To: dm-devel; +Cc: samitolvanen
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [bug report] dm verity: add support for forward error correction
2018-09-25 12:07 [bug report] dm verity: add support for forward error correction Dan Carpenter
@ 2018-09-25 16:03 ` Sami Tolvanen
2018-09-26 10:14 ` Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: Sami Tolvanen @ 2018-09-25 16:03 UTC (permalink / raw)
To: dan.carpenter; +Cc: device-mapper development
On Tue, Sep 25, 2018 at 5:07 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> The patch a739ff3f543a: "dm verity: add support for forward error
> correction" from Dec 3, 2015, leads to the following static checker
> warning:
Has something changed since the last time you reported this warning?
https://www.redhat.com/archives/dm-devel/2018-June/msg00164.html
Sami
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [bug report] dm verity: add support for forward error correction
2018-09-25 16:03 ` Sami Tolvanen
@ 2018-09-26 10:14 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2018-09-26 10:14 UTC (permalink / raw)
To: Sami Tolvanen; +Cc: device-mapper development
On Tue, Sep 25, 2018 at 09:03:40AM -0700, Sami Tolvanen wrote:
> On Tue, Sep 25, 2018 at 5:07 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > The patch a739ff3f543a: "dm verity: add support for forward error
> > correction" from Dec 3, 2015, leads to the following static checker
> > warning:
>
> Has something changed since the last time you reported this warning?
>
> https://www.redhat.com/archives/dm-devel/2018-June/msg00164.html
>
Gar... Sorry. The only thing that changed is my computer. I try to
keep a record of old warnings I've sent but it must be on my other
system.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [bug report] dm verity: add support for forward error correction
2018-06-14 14:33 Dan Carpenter
@ 2018-06-14 15:54 ` Sami Tolvanen
0 siblings, 0 replies; 5+ messages in thread
From: Sami Tolvanen @ 2018-06-14 15:54 UTC (permalink / raw)
To: dan.carpenter; +Cc: device-mapper development
On Thu, Jun 14, 2018 at 7:33 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
> Apparently, if the read is a blocking read then new_read() returns NULL.
It looks like new_read can return NULL only if it's called with NF_GET
or NF_PREFETCH. dm_bufio_read calls it with NF_READ, which means it
shouldn't return NULL. Someone more familiar with dm-bufio, please
correct me if I'm wrong.
Sami
^ permalink raw reply [flat|nested] 5+ messages in thread
* [bug report] dm verity: add support for forward error correction
@ 2018-06-14 14:33 Dan Carpenter
2018-06-14 15:54 ` Sami Tolvanen
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2018-06-14 14:33 UTC (permalink / raw)
To: samitolvanen; +Cc: dm-devel
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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-09-26 10:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-25 12:07 [bug report] dm verity: add support for forward error correction Dan Carpenter
2018-09-25 16:03 ` 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
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.