From patchwork Sat Dec 12 11:02:24 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Marek X-Patchwork-Id: 66924 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 nBCB2peu016120 for ; Sat, 12 Dec 2009 11:02:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752656AbZLLLCn (ORCPT ); Sat, 12 Dec 2009 06:02:43 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756041AbZLLLCm (ORCPT ); Sat, 12 Dec 2009 06:02:42 -0500 Received: from cantor2.suse.de ([195.135.220.15]:52513 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752656AbZLLLCm (ORCPT ); Sat, 12 Dec 2009 06:02:42 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id B11DF8655F; Sat, 12 Dec 2009 12:02:48 +0100 (CET) Received: by sepie.suse.cz (Postfix, from userid 10020) id 38C867646D; Sat, 12 Dec 2009 12:02:48 +0100 (CET) From: Michal Marek To: Rusty Russell Cc: linux-kbuild@vger.kernel.org, linux-kernek@vger.kernel.org Subject: [PATCH] modpost: fix segfault with short symbol names Date: Sat, 12 Dec 2009 12:02:24 +0100 Message-Id: <1260615744-23165-1-git-send-email-mmarek@suse.cz> X-Mailer: git-send-email 1.6.5.3 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 801a16a..065ee0b 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -515,7 +515,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, break; case SHN_ABS: /* CRC'd symbol */ - if (memcmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) { + if (strncmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) { crc = (unsigned int) sym->st_value; sym_update_crc(symname + strlen(CRC_PFX), mod, crc, export); @@ -559,7 +559,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, break; default: /* All exported symbols */ - if (memcmp(symname, KSYMTAB_PFX, strlen(KSYMTAB_PFX)) == 0) { + if (strncmp(symname, KSYMTAB_PFX, strlen(KSYMTAB_PFX)) == 0) { sym_add_exported(symname + strlen(KSYMTAB_PFX), mod, export); }