From patchwork Fri Jun 5 13:03:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ameya Palande X-Patchwork-Id: 28216 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n55D3MAl015289 for ; Fri, 5 Jun 2009 13:03:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751809AbZFENDQ (ORCPT ); Fri, 5 Jun 2009 09:03:16 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751912AbZFENDQ (ORCPT ); Fri, 5 Jun 2009 09:03:16 -0400 Received: from smtp.nokia.com ([192.100.105.134]:46207 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751809AbZFENDP (ORCPT ); Fri, 5 Jun 2009 09:03:15 -0400 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx09.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n55D31kJ021912; Fri, 5 Jun 2009 08:03:17 -0500 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 5 Jun 2009 16:03:12 +0300 Received: from mgw-da01.ext.nokia.com ([147.243.128.24]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Fri, 5 Jun 2009 16:03:01 +0300 Received: from localhost.localdomain (esdhcp04162.research.nokia.com [172.21.41.62]) by mgw-da01.ext.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n55D2ukV004962; Fri, 5 Jun 2009 16:02:57 +0300 From: Ameya Palande To: linux-omap@vger.kernel.org Cc: x0095840@ti.com, h-kanigeri2@ti.com Subject: [PATCHv3] DSPBRIDGE: Buffer size warning fixes Date: Fri, 5 Jun 2009 16:03:14 +0300 Message-Id: <1244206994-25290-1-git-send-email-ameya.palande@nokia.com> X-Mailer: git-send-email 1.6.2.4 In-Reply-To: <1244205782-22610-1-git-send-email-ameya.palande@nokia.com> References: <1244205782-22610-1-git-send-email-ameya.palande@nokia.com> X-OriginalArrivalTime: 05 Jun 2009 13:03:01.0687 (UTC) FILETIME=[F4F30470:01C9E5DD] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Signed-off-by: Ameya Palande --- drivers/dsp/bridge/pmgr/cod.c | 3 ++- drivers/dsp/bridge/rmgr/drv.c | 5 +++-- drivers/dsp/bridge/services/regsup.c | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/dsp/bridge/pmgr/cod.c b/drivers/dsp/bridge/pmgr/cod.c index 6363f1e..2da46bd 100644 --- a/drivers/dsp/bridge/pmgr/cod.c +++ b/drivers/dsp/bridge/pmgr/cod.c @@ -628,7 +628,8 @@ DSP_STATUS COD_OpenBase(struct COD_MANAGER *hMgr, IN char *pszCoffPath, } else { /* hang onto the library for subsequent sym table usage */ hMgr->baseLib = lib; - strncpy(hMgr->szZLFile, pszCoffPath, COD_MAXPATHLENGTH); + strncpy(hMgr->szZLFile, pszCoffPath, COD_MAXPATHLENGTH - 1); + hMgr->szZLFile[COD_MAXPATHLENGTH - 1] = '\0'; } return status; diff --git a/drivers/dsp/bridge/rmgr/drv.c b/drivers/dsp/bridge/rmgr/drv.c index a1ba19e..66e4a4d 100644 --- a/drivers/dsp/bridge/rmgr/drv.c +++ b/drivers/dsp/bridge/rmgr/drv.c @@ -1508,8 +1508,9 @@ DSP_STATUS DRV_RequestResources(u32 dwContext, u32 *pDevNodeString) pszdevNode = MEM_Calloc(sizeof(struct DRV_EXT), MEM_NONPAGED); if (pszdevNode) { LST_InitElem(&pszdevNode->link); - strncpy((char *) pszdevNode->szString, - (char *)dwContext, MAXREGPATHLENGTH); + strncpy(pszdevNode->szString, + (char *)dwContext, MAXREGPATHLENGTH - 1); + pszdevNode->szString[MAXREGPATHLENGTH - 1] = '\0'; /* Update the Driver Object List */ *pDevNodeString = (u32)pszdevNode->szString; LST_PutTail(pDRVObject->devNodeString, diff --git a/drivers/dsp/bridge/services/regsup.c b/drivers/dsp/bridge/services/regsup.c index 5251b68..bec8e92 100644 --- a/drivers/dsp/bridge/services/regsup.c +++ b/drivers/dsp/bridge/services/regsup.c @@ -238,8 +238,10 @@ DSP_STATUS regsupSetValue(char *valName, void *pBuf, u32 dataSize) /* No match, need to make a new entry */ /* First check to see if we can make any more entries. */ if (pRegKey->numValueEntries < BRIDGE_MAX_NUM_REG_ENTRIES) { - strncpy(pRegKey->values[pRegKey->numValueEntries].name, - valName, BRIDGE_MAX_NAME_SIZE); + char *tmp_name = + pRegKey->values[pRegKey->numValueEntries].name; + strncpy(tmp_name, valName, BRIDGE_MAX_NAME_SIZE - 1); + tmp_name[BRIDGE_MAX_NAME_SIZE - 1] = '\0'; pRegKey->values[pRegKey->numValueEntries].pData = MEM_Alloc(dataSize, MEM_NONPAGED); if (pRegKey->values[pRegKey->numValueEntries].pData !=