diff options
author | Yann Gautier <yann.gautier@st.com> | 2018-11-09 18:21:04 +0100 |
---|---|---|
committer | Yann Gautier <yann.gautier@st.com> | 2018-11-09 18:22:01 +0100 |
commit | 4cb17707b5c83e47477d743cb1129fc0c75a15c1 (patch) | |
tree | 1a0345efc14fded8980da4471b7d4b9cc100cd1c /drivers/partition | |
parent | 3c471c35812bc7863509dda1aedad08d35b48896 (diff) |
drivers: partition: correct some static analysis tools issues
cppcheck:
[drivers/partition/gpt.c:19] -> [drivers/partition/gpt.c:19]:
(warning) Either the condition 'str_in!=((void*)0)' is redundant
or there is possible null pointer dereference: name.
sparse:
drivers/partition/gpt.c:39:9:
warning: Using plain integer as NULL pointer
Signed-off-by: Yann Gautier <yann.gautier@st.com>
Diffstat (limited to 'drivers/partition')
-rw-r--r-- | drivers/partition/gpt.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/partition/gpt.c b/drivers/partition/gpt.c index 9cc917d3..0c51e62a 100644 --- a/drivers/partition/gpt.c +++ b/drivers/partition/gpt.c @@ -13,10 +13,14 @@ static int unicode_to_ascii(unsigned short *str_in, unsigned char *str_out) { - uint8_t *name = (uint8_t *)str_in; + uint8_t *name; int i; - assert((str_in != NULL) && (str_out != NULL) && (name[0] != '\0')); + assert((str_in != NULL) && (str_out != NULL)); + + name = (uint8_t *)str_in; + + assert(name[0] != '\0'); /* check whether the unicode string is valid */ for (i = 1; i < (EFI_NAMELEN << 1); i += 2) { @@ -36,7 +40,7 @@ int parse_gpt_entry(gpt_entry_t *gpt_entry, partition_entry_t *entry) { int result; - assert((gpt_entry != 0) && (entry != 0)); + assert((gpt_entry != NULL) && (entry != NULL)); if ((gpt_entry->first_lba == 0) && (gpt_entry->last_lba == 0)) { return -EINVAL; |