aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2015-09-08 15:44:59 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-09-09 15:54:34 +1000
commit8cc141cac8d734fe22413ee1034f578bddbacae0 (patch)
tree1740b6954fa0bff276595c695b381e42819e822e
parentc4b04acd2748f80a5d57e1f70f3bbde717b95338 (diff)
downloadskiboot-8cc141cac8d734fe22413ee1034f578bddbacae0.zip
skiboot-8cc141cac8d734fe22413ee1034f578bddbacae0.tar.gz
skiboot-8cc141cac8d734fe22413ee1034f578bddbacae0.tar.bz2
Fix comparing array to null is always true
This should be a strlen() comparison instead of comparing the truthiness of an array. This should be safe as everywhere does populate label, if only with an empty string. Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--core/pci.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/pci.c b/core/pci.c
index b55ef35..26ed48c 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -1129,8 +1129,8 @@ static void pci_add_slot_properties(struct phb *phb, struct pci_slot_info *info,
base_loc_code_len = strlen(phb->base_loc_code);
strcpy(loc_code, phb->base_loc_code);
}
- if (info->label) {
- slot_label_len = strlen(info->label);
+ slot_label_len = strlen(info->label);
+ if (slot_label_len) {
if ((base_loc_code_len + slot_label_len + 1) < LOC_CODE_SIZE) {
if (base_loc_code_len)
strcat(loc_code, "-");