From patchwork Fri Jun 5 12:43:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ameya Palande X-Patchwork-Id: 28211 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 n55ChBCQ013718 for ; Fri, 5 Jun 2009 12:43:11 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750984AbZFEMnG (ORCPT ); Fri, 5 Jun 2009 08:43:06 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751162AbZFEMnG (ORCPT ); Fri, 5 Jun 2009 08:43:06 -0400 Received: from smtp.nokia.com ([192.100.105.134]:44322 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750984AbZFEMnF (ORCPT ); Fri, 5 Jun 2009 08:43:05 -0400 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx09.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n55CfQkc001595; Fri, 5 Jun 2009 07:43:07 -0500 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 5 Jun 2009 15:42:46 +0300 Received: from mgw-sa02.ext.nokia.com ([147.243.1.48]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Fri, 5 Jun 2009 15:42:46 +0300 Received: from localhost.localdomain (esdhcp04162.research.nokia.com [172.21.41.62]) by mgw-sa02.ext.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n55CgktP027767; Fri, 5 Jun 2009 15:42:46 +0300 From: Ameya Palande To: linux-omap@vger.kernel.org Cc: x0095840@ti.com, h-kanigeri2@ti.com Subject: [PATCHv2] DSPBRIDGE: Buffer size warning fixes Date: Fri, 5 Jun 2009 15:43:02 +0300 Message-Id: <1244205782-22610-1-git-send-email-ameya.palande@nokia.com> X-Mailer: git-send-email 1.6.2.4 In-Reply-To: <1242730169-14523-1-git-send-email-ameya.palande@nokia.com> References: <1242730169-14523-1-git-send-email-ameya.palande@nokia.com> X-OriginalArrivalTime: 05 Jun 2009 12:42:46.0745 (UTC) FILETIME=[20C99490:01C9E5DB] 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..5cba816 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); + strncpy(pRegKey->values[pRegKey->numValueEntries].name, + valName, BRIDGE_MAX_NAME_SIZE - 1); + pRegKey->values[pRegKey->numValueEntries].name[BRIDGE_MAX_NAME_SIZE - 1] = + '\0'; pRegKey->values[pRegKey->numValueEntries].pData = MEM_Alloc(dataSize, MEM_NONPAGED); if (pRegKey->values[pRegKey->numValueEntries].pData !=