hpsa: fix path_info_show

Left off some changes from Rasmus Villemoes where he changed snprintf to
scnprintf.

Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Justin Lindley <justin.lindley@pmcs.com>
Reviewed-by: Kevin Barnett <kevin.barnett@pmcs.com>
Reviewed-by: Scott Teel <scott.teel@pmcs.com>
Reviewed-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Don Brace <don.brace@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
Don Brace 2015-12-22 10:36:36 -06:00 committed by Martin K. Petersen
parent a8036dfba9
commit 2708f2957c

View File

@ -795,7 +795,7 @@ static ssize_t path_info_show(struct device *dev,
if (hdev->external || if (hdev->external ||
hdev->devtype == TYPE_RAID || hdev->devtype == TYPE_RAID ||
is_logical_device(hdev)) { is_logical_device(hdev)) {
output_len += snprintf(buf + output_len, output_len += scnprintf(buf + output_len,
PAGE_SIZE - output_len, PAGE_SIZE - output_len,
"%s\n", active); "%s\n", active);
continue; continue;
@ -809,28 +809,28 @@ static ssize_t path_info_show(struct device *dev,
if (phys_connector[1] < '0') if (phys_connector[1] < '0')
phys_connector[1] = '0'; phys_connector[1] = '0';
if (hdev->phys_connector[i] > 0) if (hdev->phys_connector[i] > 0)
output_len += snprintf(buf + output_len, output_len += scnprintf(buf + output_len,
PAGE_SIZE - output_len, PAGE_SIZE - output_len,
"PORT: %.2s ", "PORT: %.2s ",
phys_connector); phys_connector);
if (hdev->devtype == TYPE_DISK && hdev->expose_device) { if (hdev->devtype == TYPE_DISK && hdev->expose_device) {
if (box == 0 || box == 0xFF) { if (box == 0 || box == 0xFF) {
output_len += snprintf(buf + output_len, output_len += scnprintf(buf + output_len,
PAGE_SIZE - output_len, PAGE_SIZE - output_len,
"BAY: %hhu %s\n", "BAY: %hhu %s\n",
bay, active); bay, active);
} else { } else {
output_len += snprintf(buf + output_len, output_len += scnprintf(buf + output_len,
PAGE_SIZE - output_len, PAGE_SIZE - output_len,
"BOX: %hhu BAY: %hhu %s\n", "BOX: %hhu BAY: %hhu %s\n",
box, bay, active); box, bay, active);
} }
} else if (box != 0 && box != 0xFF) { } else if (box != 0 && box != 0xFF) {
output_len += snprintf(buf + output_len, output_len += scnprintf(buf + output_len,
PAGE_SIZE - output_len, "BOX: %hhu %s\n", PAGE_SIZE - output_len, "BOX: %hhu %s\n",
box, active); box, active);
} else } else
output_len += snprintf(buf + output_len, output_len += scnprintf(buf + output_len,
PAGE_SIZE - output_len, "%s\n", active); PAGE_SIZE - output_len, "%s\n", active);
} }