From patchwork Thu Sep 7 19:35:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9942769 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 5D475600CB for ; Thu, 7 Sep 2017 19:35:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53CD01FF15 for ; Thu, 7 Sep 2017 19:35:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4880920090; Thu, 7 Sep 2017 19:35:19 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 8AF501FF15 for ; Thu, 7 Sep 2017 19:35:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755684AbdIGTfR (ORCPT ); Thu, 7 Sep 2017 15:35:17 -0400 Received: from mail-pf0-f175.google.com ([209.85.192.175]:36167 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755583AbdIGTfQ (ORCPT ); Thu, 7 Sep 2017 15:35:16 -0400 Received: by mail-pf0-f175.google.com with SMTP id e199so994014pfh.3 for ; Thu, 07 Sep 2017 12:35:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition; bh=A3eeeBrmttbXX77QlK6RdeFOrlFr5YJTyzSXrXhtdEM=; b=mDLV5suJln1pnBtzkyGYKzXMr+9LgIn3n+WMYnY33i9D9KClMuJ06XwTEy+rq8JuNC wk5+Sqaze5l3sxamX8vqwInFFL8/8UQO/hXzJdx3rz++lCmfDsdvRz+Gd1w9jNAy9Cma oPNofnxqTgnFU4FLKuXaKDMgvTWbgiP1w+2R0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=A3eeeBrmttbXX77QlK6RdeFOrlFr5YJTyzSXrXhtdEM=; b=CnUYfbx3a8wWyjLw9I7DjPCtxDTpeTMM8/wlaCoyaS20jvuFgRviSTb8dgwA1qbJkx gJAcS1f+FX7DPgdsX+gELMQmvTWM95zCwjlccW8W40QqGG8Ts3XwSuPzPecdERaLvRjy VMJpN6ApsI+NA2fGjBv8Bi5DxG8SzVb5rMmP/Vb1Gq+SZvYBaNzeSEaegvGQWmarSvRh YDMCsH89W8BcItGhDXyntR7KcRxO8u8KRbi2bKTekUP73/zq+sp1esc7da3ThEE3Fbcx zoq55Z/aByKFV6QqKikqCMbJ5QRe+5yxOZidKynbqQSnYwkgzhXe93dNo3oQTL2GOU6Z /VmA== X-Gm-Message-State: AHPjjUgV5rNrlpsZO95CgHiB2JWquJXeCeKxn7iuO2AvkVthK3ACVAYn +Zb1jv1LQZykDSQb X-Google-Smtp-Source: ADKCNb7bPUlIDMU3EXxp/wTfoSFNXTU7aUproUuxcadC0Eq5g2o8WWP2JJHsgYVmAaVf1YGGDbZx3A== X-Received: by 10.101.85.4 with SMTP id f4mr497506pgr.10.1504812916218; Thu, 07 Sep 2017 12:35:16 -0700 (PDT) Received: from www.outflux.net (173-164-112-133-Oregon.hfc.comcastbusiness.net. [173.164.112.133]) by smtp.gmail.com with ESMTPSA id r12sm492373pfd.187.2017.09.07.12.35.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Sep 2017 12:35:15 -0700 (PDT) Date: Thu, 7 Sep 2017 12:35:14 -0700 From: Kees Cook To: netdev@vger.kernel.org Cc: "David S. Miller" , Jarod Wilson , "Gustavo A. R. Silva" , linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: tulip: Constify tulip_tbl Message-ID: <20170907193514.GA114400@beast> MIME-Version: 1.0 Content-Disposition: inline Sender: linux-parisc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-parisc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It looks like all users of tulip_tbl are reads, so mark this table as read-only. $ git grep tulip_tbl # edited to avoid line-wraps... interrupt.c: iowrite32(tulip_tbl[tp->chip_id].valid_intrs, ... interrupt.c: iowrite32(tulip_tbl[tp->chip_id].valid_intrs&~RxPollInt, ... interrupt.c: iowrite32(tulip_tbl[tp->chip_id].valid_intrs, ... interrupt.c: iowrite32(tulip_tbl[tp->chip_id].valid_intrs | TimerInt, pnic.c: iowrite32(tulip_tbl[tp->chip_id].valid_intrs, ioaddr + CSR7); tulip.h: extern struct tulip_chip_table tulip_tbl[]; tulip_core.c:struct tulip_chip_table tulip_tbl[] = { tulip_core.c:iowrite32(tulip_tbl[tp->chip_id].valid_intrs, ioaddr + CSR5); tulip_core.c:iowrite32(tulip_tbl[tp->chip_id].valid_intrs, ioaddr + CSR7); tulip_core.c:setup_timer(&tp->timer, tulip_tbl[tp->chip_id].media_timer, tulip_core.c:const char *chip_name = tulip_tbl[chip_idx].chip_name; tulip_core.c:if (pci_resource_len (pdev, 0) < tulip_tbl[chip_idx].io_size) tulip_core.c:ioaddr = pci_iomap(..., tulip_tbl[chip_idx].io_size); tulip_core.c:tp->flags = tulip_tbl[chip_idx].flags; tulip_core.c:setup_timer(&tp->timer, tulip_tbl[tp->chip_id].media_timer, tulip_core.c:INIT_WORK(&tp->media_work, tulip_tbl[tp->chip_id].media_task); Cc: "David S. Miller" Cc: Jarod Wilson Cc: "Gustavo A. R. Silva" Cc: netdev@vger.kernel.org Cc: linux-parisc@vger.kernel.org Signed-off-by: Kees Cook --- drivers/net/ethernet/dec/tulip/tulip.h | 2 +- drivers/net/ethernet/dec/tulip/tulip_core.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/dec/tulip/tulip.h b/drivers/net/ethernet/dec/tulip/tulip.h index 38431a155f09..06660dbc44b7 100644 --- a/drivers/net/ethernet/dec/tulip/tulip.h +++ b/drivers/net/ethernet/dec/tulip/tulip.h @@ -515,7 +515,7 @@ void comet_timer(unsigned long data); extern int tulip_debug; extern const char * const medianame[]; extern const char tulip_media_cap[]; -extern struct tulip_chip_table tulip_tbl[]; +extern const struct tulip_chip_table tulip_tbl[]; void oom_timer(unsigned long data); extern u8 t21040_csr13[]; diff --git a/drivers/net/ethernet/dec/tulip/tulip_core.c b/drivers/net/ethernet/dec/tulip/tulip_core.c index 84394b43c0a1..851b6d1f5a42 100644 --- a/drivers/net/ethernet/dec/tulip/tulip_core.c +++ b/drivers/net/ethernet/dec/tulip/tulip_core.c @@ -138,7 +138,7 @@ static void tulip_timer(unsigned long data) * It is indexed via the values in 'enum chips' */ -struct tulip_chip_table tulip_tbl[] = { +const struct tulip_chip_table tulip_tbl[] = { { }, /* placeholder for array, slot unused currently */ { }, /* placeholder for array, slot unused currently */