From: Mimi Zohar <zohar@linux.vnet.ibm.com>
To: linux-security-module@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Andy Shevchenko <andy.shevchenko@gmail.com>,
Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
Arnaud Lacombe <lacombar@gmail.com>,
James.Mor@us.ibm.com
Subject: Re: [PATCH v1 4/4] target: check hex2bin result (updated)
Date: Wed, 21 Sep 2011 08:35:31 -0400 [thread overview]
Message-ID: <1316608531.3155.8.camel@localhost.localdomain> (raw)
In-Reply-To: <1316548373-8782-5-git-send-email-zohar@linux.vnet.ibm.com>
Now that hex2bin does error checking, on error add debugging error msg.
Changelog v1 (update):
- fixed definition of 'ret'
- hex2bin now returns an int
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/target/target_core_fabric_lib.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c
index c4ea3a9..39f021b 100644
--- a/drivers/target/target_core_fabric_lib.c
+++ b/drivers/target/target_core_fabric_lib.c
@@ -63,6 +63,7 @@ u32 sas_get_pr_transport_id(
unsigned char *buf)
{
unsigned char *ptr;
+ int ret;
/*
* Set PROTOCOL IDENTIFIER to 6h for SAS
@@ -74,7 +75,9 @@ u32 sas_get_pr_transport_id(
*/
ptr = &se_nacl->initiatorname[4]; /* Skip over 'naa. prefix */
- hex2bin(&buf[4], ptr, 8);
+ ret = hex2bin(&buf[4], ptr, 8);
+ if (ret < 0)
+ pr_debug("sas transport_id: invalid hex string\n");
/*
* The SAS Transport ID is a hardcoded 24-byte length
@@ -156,8 +159,9 @@ u32 fc_get_pr_transport_id(
unsigned char *buf)
{
unsigned char *ptr;
- int i;
+ int i, ret;
u32 off = 8;
+
/*
* PROTOCOL IDENTIFIER is 0h for FCP-2
*
@@ -174,7 +178,9 @@ u32 fc_get_pr_transport_id(
i++;
continue;
}
- hex2bin(&buf[off++], &ptr[i], 1);
+ ret = hex2bin(&buf[off++], &ptr[i], 1);
+ if (ret < 0)
+ pr_debug("fc transport_id: invalid hex string\n");
i += 2;
}
/*
--
1.7.3.4
prev parent reply other threads:[~2011-09-21 12:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-20 19:52 [PATCH v1 0/4] lib: hex2bin error checking Mimi Zohar
2011-09-20 19:52 ` [PATCH v1 1/4] lib: add error checking to hex2bin Mimi Zohar
2011-09-20 19:52 ` [PATCH v1 2/4] trusted-keys: check hex2bin result Mimi Zohar
2011-09-20 19:52 ` [PATCH v1 3/4] encrypted-keys: " Mimi Zohar
2011-09-20 19:52 ` [PATCH v1 4/4] target: " Mimi Zohar
2011-09-20 23:55 ` Andy Shevchenko
2011-09-21 3:41 ` Mimi Zohar
2011-09-21 15:04 ` Mimi Zohar
2011-09-21 12:35 ` Mimi Zohar [this message]
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=1316608531.3155.8.camel@localhost.localdomain \
--to=zohar@linux.vnet.ibm.com \
--cc=James.Mor@us.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=andy.shevchenko@gmail.com \
--cc=lacombar@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
/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;
as well as URLs for NNTP newsgroup(s).