Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755924AbcJLQy7 (ORCPT ); Wed, 12 Oct 2016 12:54:59 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:46871 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755895AbcJLQyq (ORCPT ); Wed, 12 Oct 2016 12:54:46 -0400 From: Loic Pallardy To: , , CC: , , , Subject: [PATCH v3 11/20] remoteproc: core: Correction carveout name comparison in rproc_update_resource_table_entry Date: Wed, 12 Oct 2016 18:00:29 +0200 Message-ID: <1476288038-24909-12-git-send-email-loic.pallardy@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1476288038-24909-1-git-send-email-loic.pallardy@st.com> References: <1476288038-24909-1-git-send-email-loic.pallardy@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.201.23.23] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-10-12_09:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 871 Lines: 26 As old and new carveout name length may be different and the two names may have a common part, name comparison must cover the complete name field. Limit strncmp to carveout name length, i.e. 32 Bytes. Signed-off-by: Loic Pallardy --- drivers/remoteproc/remoteproc_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index 4a61dc1..96692c2 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -956,8 +956,7 @@ static int rproc_update_resource_table_entry(struct rproc *rproc, tblc = rsc; newc = request->resource; - if (strncmp(newc->name, tblc->name, - sizeof(*tblc->name))) + if (strncmp(newc->name, tblc->name, 32)) break; memcpy(tblc, newc, request->size); -- 1.9.1