All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: Wei Liu <wei.liu2@citrix.com>, Lasya Venneti <comethalley61@gmail.com>
Cc: xen-devel@lists.xenproject.org, dario.faggioli@citrix.com,
	stefano.stebellini@eu.citrix.com, george.dunlap@citrix.com,
	lars.kurth@citrix.com
Subject: Re: [PATCH] Handles the error returned by the xc_dom_allocate function
Date: Mon, 2 Nov 2015 12:02:07 +0000	[thread overview]
Message-ID: <1446465727.3088.20.camel@citrix.com> (raw)
In-Reply-To: <20151026104018.GQ5060@zion.uk.xensource.com>

On Mon, 2015-10-26 at 10:40 +0000, Wei Liu wrote:

> > +		return -1;
> 
> And, please set rv to a proper error code (presumably ENOMEM)

Please don't, xc_* functions should return -1 or NULL and set errno on
failure. (libxc error reporting is a bit of a mess, but this is the
intention).

So the caller here can assume that errno has already been set to something
appropriate (probably ENOMEM) and it is fine to translate the NULL into a 
-1 since the overall function returns an int not a pointer.

>  and use goto err, otherwise you're leaking xs_fd.

This is good advise and implies that rv should be set to -1 before the
goto.

  reply	other threads:[~2015-11-02 12:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-25 10:02 [PATCH] Fixing coverity bug CID1311511 Lasya Venneti
2015-10-25 10:02 ` [PATCH] Handles the error returned by the xc_dom_allocate function Lasya Venneti
2015-10-26 10:40   ` Wei Liu
2015-11-02 12:02     ` Ian Campbell [this message]
2015-10-26  9:09 ` [PATCH] Fixing coverity bug CID1311511 Dario Faggioli
2015-10-26  9:18   ` Lasya Venneti
2015-10-26  9:21     ` Lasya Venneti

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=1446465727.3088.20.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=comethalley61@gmail.com \
    --cc=dario.faggioli@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=lars.kurth@citrix.com \
    --cc=stefano.stebellini@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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 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.