From patchwork Sun Sep 3 12:07:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 9936125 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 5C93E603D7 for ; Sun, 3 Sep 2017 12:09:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E310286A9 for ; Sun, 3 Sep 2017 12:09:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 42ACD286B3; Sun, 3 Sep 2017 12:09:55 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DB200286B0 for ; Sun, 3 Sep 2017 12:09:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=q5rhn4aBAJZC7vOjLyIwaul6//SW2INP/h/0KCTmQio=; b=UP6h/H3khKtB1ZdKj+xZz2CJy1 Rdsnp8uKVtCjNM3xKH6Yy+f0/Ph3U9pzgOjRFj6hJGOxc+zXzk/2oml6Do9RL62j3/cs7XJgXEm3n 41o41erlMD6Uv0QP5c/reOt+L5GsBEhp8fDI2/d438jKyrlUV/qvfAFlyaSHokzJ2d7okPFKlGhdw CJVIkL7VHfwVEYOoZp79KL/YiXd+28pVSVuUdSgM38uvTL8/rHezEWpe6iGsb8hJwhVZzVlrwzkhE d8ZyA9X+5RP/niejGvzz/uFpOfxb40HJryJSnm16AKRhFEEnxoHXRX12rfRXrSM5dWp9X4Tjoa+KV 3xo2rczg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1doTin-0001tC-0r; Sun, 03 Sep 2017 12:09:49 +0000 Received: from mail-wr0-x22b.google.com ([2a00:1450:400c:c0c::22b]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1doThi-0001RI-Tq for linux-arm-kernel@lists.infradead.org; Sun, 03 Sep 2017 12:08:45 +0000 Received: by mail-wr0-x22b.google.com with SMTP id p14so8997964wrg.3 for ; Sun, 03 Sep 2017 05:08:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WjHLE7zLeKXtANi5+giNZUhSgv+udHd254VSbdAIWO8=; b=Ml8mLfGM6BlJkrzQGFiX9CJyNkrEg19k61Ax/b/D0PFBrpLcaT7UyoPLSoQJsCc/EY ngoNIfP9cB89MQiBuTa13Cz5IfzufruQu/JjcNAbX+fbKh8K+R5w936XWXWd6lS1VOIk tTG0az58JQ5G1z9KLowrOOFk4HIU7uEcrXO0c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WjHLE7zLeKXtANi5+giNZUhSgv+udHd254VSbdAIWO8=; b=VlROMyyfkGXP3qBp73vV5xnqC6jfLUt7ZuQgcljZpm+9vv0ArIiNSokBahUL5MbWw+ bFhbuP5cxzpXky3BFRMyRkDykIyjuWwLKS4BDqNGcaoqqOVzyDyylmhp81ubCBNMUBGQ gi9HJbVlbGmWgEcnoeCXx/sfM/NNTuReyUoJH4rpiar2q1a6Pm9Z2yzg82CESlEDJvRk WXQWNTX6zje5AuihpcGA7I5orp2QzWHWlR+7FnrqzjqzuWvMjrWk7GIOgezgVyxQhj8k M43ZemdZd0FbmYSuvHrdvNsyfoHyknCFKVz3nNebGse4hotv2UhC5ihZ0M3znSxbyedK BHzw== X-Gm-Message-State: AHPjjUjk3bukfSc6DHXsqtEJ6/8lapxphJxrU77koQ7y33znKp+2CeCJ FfnxZlPWEXpa4FaQN6RvUQ== X-Google-Smtp-Source: ADKCNb6nrFudOt7EUrFf+C7G3X6i7GLIzjO8vxSv4gH4LSbvTr5AEM1Wg/Lx6qbDkZhw9DvI1ice/Q== X-Received: by 10.223.177.193 with SMTP id r1mr4291443wra.50.1504440499796; Sun, 03 Sep 2017 05:08:19 -0700 (PDT) Received: from localhost.localdomain ([154.151.223.220]) by smtp.gmail.com with ESMTPSA id b196sm4392664wmd.29.2017.09.03.05.08.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 03 Sep 2017 05:08:18 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, kernel-hardening@lists.openwall.com Subject: [PATCH v2 01/29] net/core: work around section mismatch warning for ptp_classifier Date: Sun, 3 Sep 2017 13:07:29 +0100 Message-Id: <20170903120757.14968-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170903120757.14968-1-ard.biesheuvel@linaro.org> References: <20170903120757.14968-1-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170903_050843_192136_708613AC X-CRM114-Status: GOOD ( 12.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Kees Cook , Arnd Bergmann , Nicolas Pitre , Marc Zyngier , Ard Biesheuvel , Russell King , Dave Martin , Tony Lindgren , "David S. Miller" , Thomas Garnier , Matt Fleming MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The routine ptp_classifier_init() uses an initializer for an automatic struct type variable which refers to an __initdata symbol. This is perfectly legal, but may trigger a section mismatch warning when running the compiler in -fpic mode, due to the fact that the initializer may be emitted into an anonymous .data section thats lack the __init annotation. So work around it by using assignments instead. Cc: "David S. Miller" Signed-off-by: Ard Biesheuvel --- net/core/ptp_classifier.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/net/core/ptp_classifier.c b/net/core/ptp_classifier.c index 703cf76aa7c2..7109c168b5e0 100644 --- a/net/core/ptp_classifier.c +++ b/net/core/ptp_classifier.c @@ -185,9 +185,10 @@ void __init ptp_classifier_init(void) { 0x16, 0, 0, 0x00000000 }, { 0x06, 0, 0, 0x00000000 }, }; - struct sock_fprog_kern ptp_prog = { - .len = ARRAY_SIZE(ptp_filter), .filter = ptp_filter, - }; + struct sock_fprog_kern ptp_prog; + + ptp_prog.len = ARRAY_SIZE(ptp_filter); + ptp_prog.filter = ptp_filter; BUG_ON(bpf_prog_create(&ptp_insns, &ptp_prog)); }