public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Harkes <jaharkes@cs.cmu.edu>
To: Fabian Frederick <fabf@skynet.be>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	coda@cs.cmu.edu
Subject: Re: [PATCH 1/1 linux-next] fs/coda/upcall.c: remove UPARG flow control macro
Date: Mon, 27 Apr 2015 14:37:44 -0400	[thread overview]
Message-ID: <20150427183744.GA5147@cs.cmu.edu> (raw)
In-Reply-To: <1430155386-6678-1-git-send-email-fabf@skynet.be>

On Mon, Apr 27, 2015 at 07:23:06PM +0200, Fabian Frederick wrote:
> Move UPARG code to alloc_upcall() and test errors/return in callsites.
> This patch removes flow control in macros which must be avoided.
> (See Documentation/CodingStyle)

At first glance this is not a correct patch.

UPARG allocates a buffer that is large enough to hold both the upcall
message going to userspace as well as the incoming reply message. At
first glance this patch only seems to allocate insize. It may still be
doing the right thing because insize is defined at the call level as
MAX(sizeof(inarg), sizeof(outarg)). This it looks like quite a few
changes for an untested patch and not enough for an actual cleanup of
the related code.

Jan

> ---
> This is untested.
> 
>  fs/coda/upcall.c | 107 +++++++++++++++++++++++++++++++++++--------------------
>  1 file changed, 69 insertions(+), 38 deletions(-)
> 
> diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c
> index 9b1ffaa..7524f630 100644
> --- a/fs/coda/upcall.c
> +++ b/fs/coda/upcall.c
> @@ -41,30 +41,24 @@
>  static int coda_upcall(struct venus_comm *vc, int inSize, int *outSize,
>  		       union inputArgs *buffer);
>  
> -static void *alloc_upcall(int opcode, int size)
> +static int alloc_upcall(int opcode, int insize, int *outsize,
> +			union inputArgs **inp, union outputArgs **outp)
>  {
> -	union inputArgs *inp;
> +	CODA_ALLOC(*inp, union inputArgs *, insize);
> +	if (!*inp)
> +		return -ENOMEM;
>  
> -	CODA_ALLOC(inp, union inputArgs *, size);
> -        if (!inp)
> -		return ERR_PTR(-ENOMEM);
...

  reply	other threads:[~2015-04-27 18:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-27 17:23 [PATCH 1/1 linux-next] fs/coda/upcall.c: remove UPARG flow control macro Fabian Frederick
2015-04-27 18:37 ` Jan Harkes [this message]
2015-04-27 19:44   ` Fabian Frederick

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=20150427183744.GA5147@cs.cmu.edu \
    --to=jaharkes@cs.cmu.edu \
    --cc=akpm@linux-foundation.org \
    --cc=coda@cs.cmu.edu \
    --cc=fabf@skynet.be \
    --cc=linux-kernel@vger.kernel.org \
    /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