[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1406413618-7691-1-git-send-email-rickard_strandqvist@spectrumdigital.se>
Date: Sun, 27 Jul 2014 00:26:58 +0200
From: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
To: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>
Cc: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>,
"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
David Cohen <david.a.cohen@...ux.intel.com>,
Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
Fei Yang <fei.yang@...el.com>,
Fengguang Wu <fengguang.wu@...el.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH] arch: x86: platform: intel-mid: sfi.c: Cleaning up missing null-terminate in conjunction with strncpy
If you are going to use memset before strncpy you must copy sizeof -1
Signed-off-by: Rickard Strandqvist <rickard_strandqvist@...ctrumdigital.se>
---
arch/x86/platform/intel-mid/sfi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/platform/intel-mid/sfi.c b/arch/x86/platform/intel-mid/sfi.c
index 994c40b..97e79c9 100644
--- a/arch/x86/platform/intel-mid/sfi.c
+++ b/arch/x86/platform/intel-mid/sfi.c
@@ -359,7 +359,7 @@ static void __init sfi_handle_spi_dev(struct sfi_device_table_entry *pentry,
void *pdata = NULL;
memset(&spi_info, 0, sizeof(spi_info));
- strncpy(spi_info.modalias, pentry->name, SFI_NAME_LEN);
+ strncpy(spi_info.modalias, pentry->name, sizeof(spi_info.modalias) - 1);
spi_info.irq = ((pentry->irq == (u8)0xff) ? 0 : pentry->irq);
spi_info.bus_num = pentry->host_num;
spi_info.chip_select = pentry->addr;
@@ -389,7 +389,7 @@ static void __init sfi_handle_i2c_dev(struct sfi_device_table_entry *pentry,
void *pdata = NULL;
memset(&i2c_info, 0, sizeof(i2c_info));
- strncpy(i2c_info.type, pentry->name, SFI_NAME_LEN);
+ strncpy(i2c_info.type, pentry->name, sizeof(i2c_info.type) - 1);
i2c_info.irq = ((pentry->irq == (u8)0xff) ? 0 : pentry->irq);
i2c_info.addr = pentry->addr;
pr_debug("I2C bus = %d, name = %16.16s, irq = 0x%2x, addr = 0x%x\n",
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists