projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e0fc443
)
block: Fix off-by-one errors in blk_status_to_errno() and print_req_error()
author
Bart Van Assche
<
[email protected]
>
Wed, 21 Jun 2017 17:55:46 +0000
(10:55 -0700)
committer
Jens Axboe
<
[email protected]
>
Wed, 21 Jun 2017 18:01:14 +0000
(12:01 -0600)
This was detected by the smatch static analyzer.
Fixes: commit 2a842acab109 ("block: introduce new block status code type")
Signed-off-by: Bart Van Assche <
[email protected]
>
Cc: Christoph Hellwig <
[email protected]
>
Cc: Hannes Reinecke <
[email protected]
>
Cc: Ming Lei <
[email protected]
>
Signed-off-by: Jens Axboe <
[email protected]
>
block/blk-core.c
patch
|
blob
|
history
diff --git
a/block/blk-core.c
b/block/blk-core.c
index 2e02314ea3319754f1e22dab2f378e693a9e14db..3c18ea60cb1c0b7dd6a038905c0c62bc795dbc89 100644
(file)
--- a/
block/blk-core.c
+++ b/
block/blk-core.c
@@
-169,7
+169,7
@@
int blk_status_to_errno(blk_status_t status)
{
int idx = (__force int)status;
- if (WARN_ON_ONCE(idx > ARRAY_SIZE(blk_errors)))
+ if (WARN_ON_ONCE(idx >
=
ARRAY_SIZE(blk_errors)))
return -EIO;
return blk_errors[idx].errno;
}
@@
-179,7
+179,7
@@
static void print_req_error(struct request *req, blk_status_t status)
{
int idx = (__force int)status;
- if (WARN_ON_ONCE(idx > ARRAY_SIZE(blk_errors)))
+ if (WARN_ON_ONCE(idx >
=
ARRAY_SIZE(blk_errors)))
return;
printk_ratelimited(KERN_ERR "%s: %s error, dev %s, sector %llu\n",