linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luis Chamberlain <mcgrof@kernel.org>
To: Joel Granados <j.granados@samsung.com>
Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>,
	Iurii Zaikin <yzaikin@google.com>,
	Kees Cook <keescook@chromium.org>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 2/6] parport: Remove register_sysctl_table from parport_proc_register
Date: Tue, 16 May 2023 14:49:29 -0700	[thread overview]
Message-ID: <ZGP6aZJ5b7WOrA07@bombadil.infradead.org> (raw)
In-Reply-To: <20230516161221.cojocvsre7uhvz7o@localhost>

On Tue, May 16, 2023 at 06:12:21PM +0200, Joel Granados wrote:
> On Tue, May 16, 2023 at 04:31:16PM +0200, Joel Granados wrote:
> > On Mon, May 15, 2023 at 09:17:39PM -0700, Luis Chamberlain wrote:
> > > Awesome!
> > > 
> > > On Mon, May 15, 2023 at 09:14:42AM +0200, Joel Granados wrote:
> > > > +
> > > > +	port_name_len = strnlen(port->name, PARPORT_NAME_MAX_LEN);
> > > > +	/*
> > > > +	 * Allocate a buffer for two paths: dev/parport/PORT and dev/parport/PORT/devices.
> > > > +	 * We calculate for the second as that will give us enough for the first.
> > > > +	 */
> > > > +	tmp_path_len = PARPORT_BASE_DEVICES_PATH_SIZE + port_name_len;
> > > > +	tmp_dir_path = kmalloc(tmp_path_len, GFP_KERNEL);
> > > 
> > > Any reason why not kzalloc()?
> > nope. Will zero it out.
> > 
> > > 
> > > > +	if (!tmp_dir_path) {
> > > > +		err = -ENOMEM;
> > > > +		goto exit_free_t;
> > > > +	}
> > > >  
> > > > -	t->port_dir[0].procname = port->name;
> > > > +	if (tmp_path_len
> > > > +	    <= snprintf(tmp_dir_path, tmp_path_len, "dev/parport/%s/devices", port->name)) {
> > > 
> > > Since we are clearing up obfuscation code, it would be nicer to
> > > make this easier to read and split the snprintf() into one line, capture
> > > the error there. And then in a new line do the check. Even if we have to
> > > add a new int value here.
> > np. Will do something like this:
> > 
> > num_chars_sprinted = snprintf(....
> > if(tmp_path_len <= num_chars_sprinted) {
> >   err = -ENOENT;
> >   ...
> > }
> > 
> > > 
> > > Other than this I'd just ask to extend the commit log to use
> > > the before and after of vmlinux (when this module is compiled in with all
> > > the bells and whistles) with ./scripts/bloat-o-meter.
> > > 
> > > Ie build before the patch and cp vmlinux to vmlinux.old and then compare
> > > with:
> > > 
> > > ./scripts/bloat-o-meter vmlinux.old vmlinux
> > > 
> > > Can you also describe any testing if any.
> > Sure thing. Will add the bloat-o-meter output on the last patch so as to
> > gather the results for all the patches.
> > 
> > I'll write some testing info on the patches.
> > 
> > 
> > > 
> > > With the above changes, feel free to add to all these patches:
> > > 
> > > Reviewed-by: Luis Chamberlain
> > Ack
> > 
> > > 
> > > > +	if (register_sysctl(tmp_dir_path, t->device_dir) == NULL)
> > > 
> > > BTW, we should be able to remove now replace register_sysctl_base() with a simple
> > > register_sysctl("kernel", foo), and then one for "fs", and one of "vm"
> > > on kernel/sysctl.c and just remove:
> > > 
> > >   * DECLARE_SYSCTL_BASE() & register_sysctl_base() & __register_sysctl_base()
> > >   * and then after all this register_sysctl_table() completely
> > > 
> > > Let me know if you'd like a stab at it, or if you prefer me to do that.
> > I think I can give it a go. Should I just add that to these set of
> > patches? or should we create a new patch set?
> I'll send the V2 of this patch set without this. Will add it to the
> patch set when I finish if it makes sense. Else I'll just create a new
> series.

New series is good.

  Luis

  reply	other threads:[~2023-05-16 21:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230515071448eucas1p111c55b7078f1541f487c9dfb1a9f9c15@eucas1p1.samsung.com>
2023-05-15  7:14 ` [PATCH 0/6] sysctl: Remove register_sysctl_table from parport Joel Granados
     [not found]   ` <CGME20230515071449eucas1p172217753f35fed55c4d2f0a419e258dd@eucas1p1.samsung.com>
2023-05-15  7:14     ` [PATCH 1/6] parport: Move magic number "15" to a define Joel Granados
     [not found]   ` <CGME20230515071450eucas1p1625a8639e2b0edf47e41126801d4cbb8@eucas1p1.samsung.com>
2023-05-15  7:14     ` [PATCH 2/6] parport: Remove register_sysctl_table from parport_proc_register Joel Granados
2023-05-16  4:17       ` Luis Chamberlain
2023-05-16 14:31         ` Joel Granados
2023-05-16 16:12           ` Joel Granados
2023-05-16 21:49             ` Luis Chamberlain [this message]
     [not found]   ` <CGME20230515071452eucas1p1d535f6636b45c193b6b24fa59ff100a6@eucas1p1.samsung.com>
2023-05-15  7:14     ` [PATCH 3/6] parport: Remove register_sysctl_table from parport_device_proc_register Joel Granados
     [not found]       ` <CGME20230515192630eucas1p2c9bf0ffa8ddc2d0bcf9a9818c6ecd6a8@eucas1p2.samsung.com>
2023-05-15 19:10         ` Joel Granados
     [not found]   ` <CGME20230515071454eucas1p2ae422c4bad233cd6170dce9e7f8304d9@eucas1p2.samsung.com>
2023-05-15  7:14     ` [PATCH 4/6] parport: Remove register_sysctl_table from parport_default_proc_register Joel Granados
     [not found]   ` <CGME20230515071456eucas1p1e92a011498b7f3ca2e02cdc8f0d39415@eucas1p1.samsung.com>
2023-05-15  7:14     ` [PATCH 5/6] parport: Removed sysctl related defines Joel Granados
     [not found]   ` <CGME20230515071457eucas1p105a2dba9f4741cd6fe495bcf527d664d@eucas1p1.samsung.com>
2023-05-15  7:14     ` [PATCH 6/6] sysctl: stop exporting register_sysctl_table Joel Granados
2023-05-15 20:24   ` [PATCH 0/6] sysctl: Remove register_sysctl_table from parport Luis Chamberlain
2023-05-16 14:06     ` Joel Granados

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZGP6aZJ5b7WOrA07@bombadil.infradead.org \
    --to=mcgrof@kernel.org \
    --cc=j.granados@samsung.com \
    --cc=keescook@chromium.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sudipm.mukherjee@gmail.com \
    --cc=yzaikin@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).