Thread (22 messages) 22 messages, 2 authors, 2019-01-21
STALE2720d
Revisions (3)
  1. v2 current
  2. v3 [diff vs current]
  3. v4 [diff vs current]

[PATCH v2 06/16] block: sed-opal: unify error handling of responses

From: David Kozub <hidden>
Date: 2019-01-17 21:34:35
Also in: lkml
Subsystem: block layer, secure encrypting device (sed) opal driver, the rest · Maintainers: Jens Axboe, Jonathan Derrick, Linus Torvalds

response_get_{string,u64} include error handling for argument resp being
NULL but response_get_token does not handle this.

Make all three of response_get_{string,u64,token} handle NULL resp in
the same way.

Co-authored-by: Jonas Rabenstein [off-list ref]
Signed-off-by: David Kozub <redacted>
Signed-off-by: Jonas Rabenstein <redacted>
---
 block/sed-opal.c | 5 +++++
 1 file changed, 5 insertions(+)
diff --git a/block/sed-opal.c b/block/sed-opal.c
index e29cb2f445ff..537cd73ea88a 100644
--- a/block/sed-opal.c
+++ b/block/sed-opal.c
@@ -702,6 +702,11 @@ static const struct opal_resp_tok *response_get_token(
 {
 	const struct opal_resp_tok *tok;
 
+	if (!resp) {
+		pr_debug("Response is NULL\n");
+		return ERR_PTR(-EINVAL);
+	}
+
 	if (n >= resp->num) {
 		pr_debug("Token number doesn't exist: %d, resp: %d\n",
 			 n, resp->num);
-- 
2.20.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help