aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/bcmdhd/dhd_custom_sec.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/wireless/bcmdhd/dhd_custom_sec.c b/drivers/net/wireless/bcmdhd/dhd_custom_sec.c
index b20aabd1d78..c099490639f 100644
--- a/drivers/net/wireless/bcmdhd/dhd_custom_sec.c
+++ b/drivers/net/wireless/bcmdhd/dhd_custom_sec.c
@@ -360,6 +360,8 @@ void get_customized_country_code(void *adapter, char *country_iso_code, wl_count
#define CIS_TUPLE_TAG_MACADDR 0x19
#define CIS_TUPLE_TAG_MACADDR_OFF ((TLV_BODY_OFF) + (1))
+#define MACBUFFER_SZ (sizeof("00:11:22:33:44:55\n"))
+
#ifdef READ_MACADDR
int dhd_read_macaddr(struct dhd_info *dhd, struct ether_addr *mac)
{
@@ -1186,7 +1188,7 @@ int dhd_write_macaddr(struct ether_addr *mac)
char *filepath_efs = MACINFO_EFS;
struct file *fp_mac = NULL;
- char buf[18] = {0};
+ char buf[MACBUFFER_SZ] = {0};
mm_segment_t oldfs = {0};
int ret = -1;
int retry_count = 0;
@@ -1209,7 +1211,7 @@ startwrite:
if (fp_mac->f_mode & FMODE_WRITE) {
ret = fp_mac->f_op->write(fp_mac, (const char *)buf,
- sizeof(buf), &fp_mac->f_pos);
+ sizeof(buf) - 1 /* skip null byte */, &fp_mac->f_pos);
if (ret < 0)
DHD_ERROR(("[WIFI_SEC] Mac address [%s] Failed to"
" write into File: %s\n", buf, filepath_data));
@@ -1249,7 +1251,7 @@ startwrite:
if (fp_mac->f_mode & FMODE_WRITE) {
ret = fp_mac->f_op->write(fp_mac, (const char *)buf,
- sizeof(buf), &fp_mac->f_pos);
+ sizeof(buf) - 1 /* skip null byte */, &fp_mac->f_pos);
if (ret < 0)
DHD_ERROR(("[WIFI_SEC] Mac address [%s] Failed to"
" write into File: %s\n", buf, filepath_efs));