All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Goldwyn Rodrigues <rgoldwyn@suse.de>
Cc: linux-integrity@vger.kernel.org, linux-unionfs@vger.kernel.org,
	iforster@suse.de, fvogt@suse.de, miklos@szeredi.hu
Subject: Re: [PATCH] Open a new file instance if no read permissions on files
Date: Mon, 08 Oct 2018 09:27:59 -0400	[thread overview]
Message-ID: <1539005279.15382.119.camel@linux.ibm.com> (raw)
In-Reply-To: <20181008121455.za53z7kgfizgtiv7@merlin>

On Mon, 2018-10-08 at 07:14 -0500, Goldwyn Rodrigues wrote:

> 
> > >  
> > > +	if (!(file->f_mode & FMODE_READ)) {
> > > +		struct file *f;
> > 
> > I would define "struct file *f = file" above, at the beginning of
> > function, and "free(f)" below, without modifying "file".
> 
> I suppose you mean fput(f).

yes

> Okay, if it makes code more understandable.

Thanks
> 
> > 
> > > +		int flags = file->f_flags & ~(O_WRONLY | O_APPEND | O_TRUNC | O_CREAT | O_NOCTTY | O_EXCL);
> > 
> > Doesn't O_RDONLY need to be added?
> 
> No. O_RDONLY is zero. But I think I should add it for readability. The
> compiler will optimize it eventually.
> 
> > Please fix the line length.
> > 
> > 
> > > +		f = dentry_open(&file->f_path, flags, file->f_cred);
> > > +		if (IS_ERR(f))
> > > +			return PTR_ERR(f);

It's late in the release cycle to be making this change.  Would it
make sense for now to fallback to modifying the original file
descriptor on failure and emit a message?

Mimi


> > > +		read = 1;
> > > +		file = f;
> > 
> > With the above change, no need to modify "file".
> 

WARNING: multiple messages have this Message-ID (diff)
From: Mimi Zohar <zohar@linux.ibm.com>
To: Goldwyn Rodrigues <rgoldwyn@suse.de>
Cc: linux-integrity@vger.kernel.org, linux-unionfs@vger.kernel.org,
	iforster@suse.de, fvogt@suse.de, miklos@szeredi.hu
Subject: Re: [PATCH] Open a new file instance if no read permissions on files
Date: Mon, 08 Oct 2018 09:27:59 -0400	[thread overview]
Message-ID: <1539005279.15382.119.camel@linux.ibm.com> (raw)
In-Reply-To: <20181008121455.za53z7kgfizgtiv7@merlin>

On Mon, 2018-10-08 at 07:14 -0500, Goldwyn Rodrigues wrote:

> 
> > >  
> > > +	if (!(file->f_mode & FMODE_READ)) {
> > > +		struct file *f;
> > 
> > I would define "struct file *f = file" above, at the beginning of
> > function, and "free(f)" below, without modifying "file".
> 
> I suppose you mean fput(f).

yes

> Okay, if it makes code more understandable.

Thanks
> 
> > 
> > > +		int flags = file->f_flags & ~(O_WRONLY | O_APPEND | O_TRUNC | O_CREAT | O_NOCTTY | O_EXCL);
> > 
> > Doesn't O_RDONLY need to be added?
> 
> No. O_RDONLY is zero. But I think I should add it for readability. The
> compiler will optimize it eventually.
> 
> > Please fix the line length.
> > 
> > 
> > > +		f = dentry_open(&file->f_path, flags, file->f_cred);
> > > +		if (IS_ERR(f))
> > > +			return PTR_ERR(f);

It's late in the release cycle to be making this change.  Would it
make sense for now to fallback to modifying the original file
descriptor on failure and emit a message?

Mimi


> > > +		read = 1;
> > > +		file = f;
> > 
> > With the above change, no need to modify "file".
> 

  reply	other threads:[~2018-10-08 20:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-05 21:42 [PATCH] Open a new file instance if no read permissions on files Goldwyn Rodrigues
2018-10-07  1:01 ` Mimi Zohar
2018-10-08 12:14   ` Goldwyn Rodrigues
2018-10-08 13:27     ` Mimi Zohar [this message]
2018-10-08 13:27       ` Mimi Zohar
2018-10-08 15:30       ` Goldwyn Rodrigues
2018-10-08 15:30         ` Goldwyn Rodrigues
2018-10-08 15:30         ` Goldwyn Rodrigues
2018-10-08 21:18         ` Mimi Zohar
2018-10-08 21:18           ` Mimi Zohar

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=1539005279.15382.119.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=fvogt@suse.de \
    --cc=iforster@suse.de \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=rgoldwyn@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.