From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751282AbdAYCte (ORCPT ); Tue, 24 Jan 2017 21:49:34 -0500 Received: from smtprelay0196.hostedemail.com ([216.40.44.196]:38641 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751137AbdAYCtd (ORCPT ); Tue, 24 Jan 2017 21:49:33 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4321:4605:5007:6119:7808:7903:8603:9121:10004:10400:10848:11232:11658:11783:11914:12043:12296:12555:12740:12895:13069:13138:13161:13229:13231:13311:13357:13439:13894:14181:14659:14721:21080:21433:21434:30054:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: care69_530b81f2de144 X-Filterd-Recvd-Size: 2744 Message-ID: <1485312569.12563.52.camel@perches.com> Subject: Re: [PATCH] nvdimm: constify device_type structures From: Joe Perches To: Dan Williams Cc: Bhumika Goyal , Julia Lawall , "linux-nvdimm@lists.01.org" , "linux-kernel@vger.kernel.org" Date: Tue, 24 Jan 2017 18:49:29 -0800 In-Reply-To: References: <1485285847-7006-1-git-send-email-bhumirks@gmail.com> <1485311842.12563.50.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.3-0ubuntu0.1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2017-01-24 at 18:40 -0800, Dan Williams wrote: > On Tue, Jan 24, 2017 at 6:37 PM, Joe Perches wrote: > > On Wed, 2017-01-25 at 00:54 +0530, Bhumika Goyal wrote: > > > Declare device_type structure as const as it is only stored in the > > > type field of a device structure. This field is of type const, so add > > > const to declaration of device_type structure. > > > > > > File size before: > > > text data bss dec hex filename > > > 19278 3199 16 22493 57dd nvdimm/namespace_devs.o > > > > > > File size after: > > > text data bss dec hex filename > > > 19929 3160 16 23105 5a41 nvdimm/namespace_devs.o > > > > Fine, but are you sure about the sizes? > > > > It seems odd the text went up 651 bytes > > while the data went down just 39 bytes. > > > > Right, the size data wasn't why I applied it. It was the general rule > of "make function pointer data read-only whenever possible to > eliminate a kernel attack vector". Exactly the correct reason it's a fine patch and one that should be applied. > Bhumika, you might want to mention > this as the motivating reason to apply the patch if you do more of > these changes. Regardless, the object sizes are still odd. The config should be mentioned because actually, the commonly compiles sizes reported are not correct. with an x86-64 defconfig I get: $ size drivers/nvdimm/namespace_devs.o*    text    data     bss     dec     hex filename   14615     519      16   15150    3b2e drivers/nvdimm/namespace_devs.o.new   14439     695      16   15150    3b2e drivers/nvdimm/namespace_devs.o.old