From patchwork Tue Jan 3 14:14:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Marek X-Patchwork-Id: 9494915 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 965C3606B4 for ; Tue, 3 Jan 2017 14:17:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BAD9271CB for ; Tue, 3 Jan 2017 14:17:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 860F6271BC; Tue, 3 Jan 2017 14:17:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D42327031 for ; Tue, 3 Jan 2017 14:17:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934488AbdACOP7 (ORCPT ); Tue, 3 Jan 2017 09:15:59 -0500 Received: from mx2.suse.de ([195.135.220.15]:57121 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757698AbdACOP2 (ORCPT ); Tue, 3 Jan 2017 09:15:28 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1C658AC74; Tue, 3 Jan 2017 14:15:26 +0000 (UTC) Received: by sepie.suse.cz (Postfix, from userid 10020) id 874F740D13; Tue, 3 Jan 2017 15:15:25 +0100 (CET) From: Michal Marek To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Borislav Petkov Subject: [PATCH 2/3] genksyms: Fix segfault with invalid declarations Date: Tue, 3 Jan 2017 15:14:55 +0100 Message-Id: <20170103141456.12743-2-mmarek@suse.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170103141456.12743-1-mmarek@suse.com> References: <20170103141456.12743-1-mmarek@suse.com> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Do not try to recover too early and segfault when parsing invalid declarations such as echo 'int (int);' | scripts/genksyms/genksyms echo 'int a, (int);' | scripts/genksyms/genksyms echo 'extern void *__inline_memcpy((void *), (const void *), (__kernel_size_t));' | scripts/genksyms/genksyms The last one was a real-life bug with include/asm-generic/asm-prototypes.h on x86_64. Reported-by: Borislav Petkov Signed-off-by: Michal Marek --- scripts/genksyms/parse.y | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/genksyms/parse.y b/scripts/genksyms/parse.y index 4fba255e54ae..00a6d7e54971 100644 --- a/scripts/genksyms/parse.y +++ b/scripts/genksyms/parse.y @@ -322,8 +322,6 @@ direct_declarator: { $$ = $2; } | '(' declarator ')' { $$ = $3; } - | '(' error ')' - { $$ = $3; } ; /* Nested declarators differ from regular declarators in that they do