Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S978261AbdDXV1P (ORCPT ); Mon, 24 Apr 2017 17:27:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46536 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S978245AbdDXV1I (ORCPT ); Mon, 24 Apr 2017 17:27:08 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AA5391555A Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jeyu@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AA5391555A Date: Mon, 24 Apr 2017 14:27:07 -0700 From: Jessica Yu To: "Naveen N. Rao" Cc: Rusty Russell , Michael Ellerman , Masami Hiramatsu , linux-kernel@vger.kernel.org Subject: Re: [PATCH] kallsyms: Use bounded strnchr() when parsing string Message-ID: <20170424212706.mp6vfa4dbgep3kzw@jeyu> References: <20170423172343.12739-1-naveen.n.rao@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20170423172343.12739-1-naveen.n.rao@linux.vnet.ibm.com> X-OS: Linux jeyu 4.11.0-rc2+ x86_64 User-Agent: NeoMutt/20161126 (1.7.1) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 24 Apr 2017 21:27:07 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 955 Lines: 31 +++ Naveen N. Rao [23/04/17 22:53 +0530]: >When parsing for the format, we use strchr() to look for >the separator, when we know that the module name can't be longer than >MODULE_NAME_LEN. Enforce the same using strnchr(). > >Signed-off-by: Naveen N. Rao Applied, thanks! Jessica >--- > kernel/module.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/kernel/module.c b/kernel/module.c >index 7eba6dea4f41..d3bd56ed3541 100644 >--- a/kernel/module.c >+++ b/kernel/module.c >@@ -4017,7 +4017,7 @@ unsigned long module_kallsyms_lookup_name(const char *name) > > /* Don't lock: we're in enough trouble already. */ > preempt_disable(); >- if ((colon = strchr(name, ':')) != NULL) { >+ if ((colon = strnchr(name, MODULE_NAME_LEN, ':')) != NULL) { > if ((mod = find_module_all(name, colon - name, false)) != NULL) > ret = mod_find_symname(mod, colon+1); > } else { >-- >2.12.1 >