From patchwork Sat Mar 25 01:03:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 9644321 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 DB31E6020B for ; Sat, 25 Mar 2017 01:05:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C2F11203C0 for ; Sat, 25 Mar 2017 01:05:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B674E269A3; Sat, 25 Mar 2017 01:05:36 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 42B0C203C0 for ; Sat, 25 Mar 2017 01:05:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755285AbdCYBFg (ORCPT ); Fri, 24 Mar 2017 21:05:36 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:36628 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755008AbdCYBFf (ORCPT ); Fri, 24 Mar 2017 21:05:35 -0400 Received: by mail-pg0-f66.google.com with SMTP id 81so962188pgh.3 for ; Fri, 24 Mar 2017 18:05:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=pbVr0Nh5woB9t9DepEBDoVdOGn5NsQy/wcj6iPpz9qU=; b=l7jGkOSTl5BNy3gjAgE7vbscWxu/dSnUFDGhJzgubKM0nZrzsvLS7Na8nuJJVS30Uq eIs53QvZ23LCJZNLOGy76omUFjNOiNL1tO+h1FRjM+3ejxF4we1uUCqhqLhe/3eIru0U lD2DmjcNWgo0oN3EWCkb/ry7LHqVXGOzgKFqMk8TEZE5CqWbvd/ku0PzfGX0wJ8Xui50 5ABI4IEkhVRtv8OTuXYuD0IgHFKQG+KZXqFeVk0lRWBJgQnVkwheA+w6YuDdRZyMmjww Iwn2gLsnvZ0eGef+x0ISksb8HBvlvv7Xm+Yq4e6ArKE1c2AsC6MK3wA/zvMTRkDFHyR6 Wltg== 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; bh=pbVr0Nh5woB9t9DepEBDoVdOGn5NsQy/wcj6iPpz9qU=; b=HUvjrYwQstD3wKX6wHF02KoNN9zMIhA1lN8RWRrAuOv+dBG/HynGiumICjztt8kX9s L091JWi2mmbT5yMTignp7868sC4xsidFPhYnP1qO7QryS4VBYqI0H3t7wBBfR0DrQR9S KYLAhZ9Y/hM49kMf1YMoBl0yTG3wWIMCVsx6eERivdS5gWsGTGuKzYqQquSXGeMZ5Aor 0hQNau7zz+1K/tTbLVXHtrv4wKeY1Ecc6NQMdUtZeyYkzT253Mk/QxC3riS1XuQ4525n ZZlocIpyGdM04YkSV9vzvJ3Ux0qijZKTNtuOoffkOgryViYAUR8D4bNxzyRbFV0QKbkB MO7g== X-Gm-Message-State: AFeK/H1B/Kt6ptVRp6l/QY0EcGYmQuvlD3glkstHh3VbhH8rPqdEFsZLIKHscN3RtmvdtQ== X-Received: by 10.84.194.195 with SMTP id h61mr14735277pld.182.1490403934367; Fri, 24 Mar 2017 18:05:34 -0700 (PDT) Received: from ebiggers-linuxstation.kir.corp.google.com ([100.119.30.131]) by smtp.gmail.com with ESMTPSA id c204sm6796420pfc.92.2017.03.24.18.05.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Mar 2017 18:05:33 -0700 (PDT) From: Eric Biggers To: linux-block@vger.kernel.org Cc: Jens Axboe , "Martin K . Petersen" , Eric Biggers Subject: [PATCH] block: constify struct blk_integrity_profile Date: Fri, 24 Mar 2017 18:03:48 -0700 Message-Id: <20170325010348.74421-1-ebiggers3@gmail.com> X-Mailer: git-send-email 2.12.1.578.ge9c3154ca4-goog Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Biggers blk_integrity_profile's are never modified, so mark them 'const' so that they are placed in .rodata and benefit from memory protection. Signed-off-by: Eric Biggers --- block/blk-integrity.c | 2 +- block/t10-pi.c | 8 ++++---- include/linux/genhd.h | 10 +++++----- include/linux/t10-pi.h | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/block/blk-integrity.c b/block/blk-integrity.c index 9f0ff5ba4f84..b3622cb00fc2 100644 --- a/block/blk-integrity.c +++ b/block/blk-integrity.c @@ -389,7 +389,7 @@ static int blk_integrity_nop_fn(struct blk_integrity_iter *iter) return 0; } -static struct blk_integrity_profile nop_profile = { +static const struct blk_integrity_profile nop_profile = { .name = "nop", .generate_fn = blk_integrity_nop_fn, .verify_fn = blk_integrity_nop_fn, diff --git a/block/t10-pi.c b/block/t10-pi.c index 2c97912335a9..680c6d636298 100644 --- a/block/t10-pi.c +++ b/block/t10-pi.c @@ -160,28 +160,28 @@ static int t10_pi_type3_verify_ip(struct blk_integrity_iter *iter) return t10_pi_verify(iter, t10_pi_ip_fn, 3); } -struct blk_integrity_profile t10_pi_type1_crc = { +const struct blk_integrity_profile t10_pi_type1_crc = { .name = "T10-DIF-TYPE1-CRC", .generate_fn = t10_pi_type1_generate_crc, .verify_fn = t10_pi_type1_verify_crc, }; EXPORT_SYMBOL(t10_pi_type1_crc); -struct blk_integrity_profile t10_pi_type1_ip = { +const struct blk_integrity_profile t10_pi_type1_ip = { .name = "T10-DIF-TYPE1-IP", .generate_fn = t10_pi_type1_generate_ip, .verify_fn = t10_pi_type1_verify_ip, }; EXPORT_SYMBOL(t10_pi_type1_ip); -struct blk_integrity_profile t10_pi_type3_crc = { +const struct blk_integrity_profile t10_pi_type3_crc = { .name = "T10-DIF-TYPE3-CRC", .generate_fn = t10_pi_type3_generate_crc, .verify_fn = t10_pi_type3_verify_crc, }; EXPORT_SYMBOL(t10_pi_type3_crc); -struct blk_integrity_profile t10_pi_type3_ip = { +const struct blk_integrity_profile t10_pi_type3_ip = { .name = "T10-DIF-TYPE3-IP", .generate_fn = t10_pi_type3_generate_ip, .verify_fn = t10_pi_type3_verify_ip, diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 76f39754e7b0..9e11082c7f9b 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -159,11 +159,11 @@ struct badblocks; #if defined(CONFIG_BLK_DEV_INTEGRITY) struct blk_integrity { - struct blk_integrity_profile *profile; - unsigned char flags; - unsigned char tuple_size; - unsigned char interval_exp; - unsigned char tag_size; + const struct blk_integrity_profile *profile; + unsigned char flags; + unsigned char tuple_size; + unsigned char interval_exp; + unsigned char tag_size; }; #endif /* CONFIG_BLK_DEV_INTEGRITY */ diff --git a/include/linux/t10-pi.h b/include/linux/t10-pi.h index 9fba9dd33544..9375d23a24e7 100644 --- a/include/linux/t10-pi.h +++ b/include/linux/t10-pi.h @@ -34,9 +34,9 @@ struct t10_pi_tuple { }; -extern struct blk_integrity_profile t10_pi_type1_crc; -extern struct blk_integrity_profile t10_pi_type1_ip; -extern struct blk_integrity_profile t10_pi_type3_crc; -extern struct blk_integrity_profile t10_pi_type3_ip; +extern const struct blk_integrity_profile t10_pi_type1_crc; +extern const struct blk_integrity_profile t10_pi_type1_ip; +extern const struct blk_integrity_profile t10_pi_type3_crc; +extern const struct blk_integrity_profile t10_pi_type3_ip; #endif