Linux CXL
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Alison Schofield <alison.schofield@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>,
	Ira Weiny <ira.weiny@intel.com>,
	Ben Widawsky <bwidawsk@kernel.org>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	linux-cxl@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/3] cxl/region: uninitialized variable in alloc_hpa()
Date: Tue, 2 Aug 2022 09:43:37 +0300	[thread overview]
Message-ID: <20220802064337.GF3460@kadam> (raw)
In-Reply-To: <62e824628507e_b0752943b@dwillia2-xfh.jf.intel.com.notmuch>

On Mon, Aug 01, 2022 at 12:07:14PM -0700, Dan Williams wrote:
> Dan Carpenter wrote:
> > This should check "p->res" instead of "res" (which is uninitialized).
> > 
> > Fixes: 23a22cd1c98b ("cxl/region: Allocate HPA capacity to regions")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> >  drivers/cxl/core/region.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> > index dc71ec457608..c80932bca667 100644
> > --- a/drivers/cxl/core/region.c
> > +++ b/drivers/cxl/core/region.c
> > @@ -454,7 +454,7 @@ static int alloc_hpa(struct cxl_region *cxlr, resource_size_t size)
> >  	lockdep_assert_held_write(&cxl_region_rwsem);
> >  
> >  	/* Nothing to do... */
> > -	if (p->res && resource_size(res) == size)
> > +	if (p->res && resource_size(p->res) == size)
> 
> Yup, looks good. Surprised this was not caught by my local compiler, or
> any of the compile-test robots.

Yeah.  It's weird.

We've disabled GCC uninitialized warnings which made me introduce a bug
last week...  But normally the Clang people and the kbuild bots fix
the bugs before I do.

regards,
dan carpenter


      reply	other threads:[~2022-08-02  6:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-01 10:19 [PATCH 1/3] cxl/region: uninitialized variable in alloc_hpa() Dan Carpenter
2022-08-01 10:20 ` [PATCH 2/3] cxl/region: prevent underflow in ways_to_cxl() Dan Carpenter
2022-08-01 19:09   ` Dan Williams
2022-08-01 10:20 ` [PATCH 3/3] cxl/region: decrement ->nr_targets on error in cxl_region_attach() Dan Carpenter
2022-08-01 10:56   ` Dan Carpenter
2022-08-01 19:49     ` Dan Williams
2022-08-01 19:11   ` Dan Williams
2022-08-01 19:07 ` [PATCH 1/3] cxl/region: uninitialized variable in alloc_hpa() Dan Williams
2022-08-02  6:43   ` Dan Carpenter [this message]

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=20220802064337.GF3460@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=alison.schofield@intel.com \
    --cc=bwidawsk@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-cxl@vger.kernel.org \
    --cc=vishal.l.verma@intel.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