From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1951886AbdDYRTE convert rfc822-to-8bit (ORCPT ); Tue, 25 Apr 2017 13:19:04 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:50093 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1951811AbdDYRSz (ORCPT ); Tue, 25 Apr 2017 13:18:55 -0400 Date: Tue, 25 Apr 2017 17:17:49 +0000 From: "Naveen N. Rao" Subject: RE: [PATCH] kallsyms: optimize kallsyms_lookup_name() for a few cases To: David Laight , Michael Ellerman Cc: "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , Masami Hiramatsu , Paul Clarke References: <20170425161822.18764-1-naveen.n.rao@linux.vnet.ibm.com> <063D6719AE5E284EB5DD2968C1650D6DCFFDB161@AcuExch.aculab.com> In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6DCFFDB161@AcuExch.aculab.com> User-Agent: astroid/0.8 (https://github.com/astroidmail/astroid) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT X-TM-AS-MML: disable x-cbid: 17042517-0052-0000-0000-00000234A59C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17042517-0053-0000-0000-0000080F72D4 Message-Id: <1493140505.ixalh10597.astroid@naverao1-tp.none> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-04-25_12:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1704250307 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Excerpts from David Laight's message of April 25, 2017 22:06: > From: Naveen N. Rao >> Sent: 25 April 2017 17:18 >> 1. Fail early for invalid/zero length symbols. >> 2. Detect names of the form and skip checking for kernel >> symbols in that case. >> >> Signed-off-by: Naveen N. Rao >> --- >> Masami, Michael, >> I have added two very simple checks here, which I felt is good to have, >> rather than the elaborate checks in the previous version. Given the >> change in module code to use strnchr(), the checks are now safe and >> further tests are not probably not that useful. > ... >> + if (strnchr(name, MODULE_NAME_LEN, ':')) >> + return module_kallsyms_lookup_name(name); > > Should that be MODULE_NAME_LEN - 1 ? The ':' character _follows_ the module name, which can itself be upto MODULE_NAME_LEN - 1 characters. So, we should look for it till MODULE_NAME_LEN. Thanks for the review, - Naveen