aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_attr.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_attr.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 162704cf6a96..ad05b266e950 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -25,6 +25,7 @@
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/aer.h> 26#include <linux/aer.h>
27#include <linux/gfp.h> 27#include <linux/gfp.h>
28#include <linux/kernel.h>
28 29
29#include <scsi/scsi.h> 30#include <scsi/scsi.h>
30#include <scsi/scsi_device.h> 31#include <scsi/scsi_device.h>
@@ -1795,12 +1796,11 @@ lpfc_soft_wwpn_store(struct device *dev, struct device_attribute *attr,
1795 1796
1796 /* Validate and store the new name */ 1797 /* Validate and store the new name */
1797 for (i=0, j=0; i < 16; i++) { 1798 for (i=0, j=0; i < 16; i++) {
1798 if ((*buf >= 'a') && (*buf <= 'f')) 1799 int value;
1799 j = ((j << 4) | ((*buf++ -'a') + 10)); 1800
1800 else if ((*buf >= 'A') && (*buf <= 'F')) 1801 value = hex_to_bin(*buf++);
1801 j = ((j << 4) | ((*buf++ -'A') + 10)); 1802 if (value >= 0)
1802 else if ((*buf >= '0') && (*buf <= '9')) 1803 j = (j << 4) | value;
1803 j = ((j << 4) | (*buf++ -'0'));
1804 else 1804 else
1805 return -EINVAL; 1805 return -EINVAL;
1806 if (i % 2) { 1806 if (i % 2) {
@@ -1888,12 +1888,11 @@ lpfc_soft_wwnn_store(struct device *dev, struct device_attribute *attr,
1888 1888
1889 /* Validate and store the new name */ 1889 /* Validate and store the new name */
1890 for (i=0, j=0; i < 16; i++) { 1890 for (i=0, j=0; i < 16; i++) {
1891 if ((*buf >= 'a') && (*buf <= 'f')) 1891 int value;
1892 j = ((j << 4) | ((*buf++ -'a') + 10)); 1892
1893 else if ((*buf >= 'A') && (*buf <= 'F')) 1893 value = hex_to_bin(*buf++);
1894 j = ((j << 4) | ((*buf++ -'A') + 10)); 1894 if (value >= 0)
1895 else if ((*buf >= '0') && (*buf <= '9')) 1895 j = (j << 4) | value;
1896 j = ((j << 4) | (*buf++ -'0'));
1897 else 1896 else
1898 return -EINVAL; 1897 return -EINVAL;
1899 if (i % 2) { 1898 if (i % 2) {