[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZUDe09oTQFz1gSsW@rric.localdomain>
Date: Tue, 31 Oct 2023 12:02:43 +0100
From: Robert Richter <rrichter@....com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: Davidlohr Bueso <dave@...olabs.net>,
Jonathan Cameron <jonathan.cameron@...wei.com>,
Dave Jiang <dave.jiang@...el.com>,
Alison Schofield <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Ira Weiny <ira.weiny@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Terry Bowman <terry.bowman@....com>, linux-cxl@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 1/2] cxl/hdm: Fix && vs || bug
On 31.10.23 12:53:52, Dan Carpenter wrote:
> If "info" is NULL then this code will crash. || was intended instead of
> &&.
>
> Fixes: 8ce520fdea24 ("cxl/hdm: Use stored Component Register mappings to map HDM decoder capability")
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
> ---
> drivers/cxl/core/hdm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cxl/core/hdm.c b/drivers/cxl/core/hdm.c
> index bc8ad4a8afca..af17da8230d5 100644
> --- a/drivers/cxl/core/hdm.c
> +++ b/drivers/cxl/core/hdm.c
> @@ -146,7 +146,7 @@ struct cxl_hdm *devm_cxl_setup_hdm(struct cxl_port *port,
>
> /* Memory devices can configure device HDM using DVSEC range regs. */
> if (reg_map->resource == CXL_RESOURCE_NONE) {
> - if (!info && !info->mem_enabled) {
> + if (!info || !info->mem_enabled) {
Right, there was a bug.
Reviewed-by: Robert Richter <rrichter@....com>
> dev_err(dev, "No component registers mapped\n");
> return ERR_PTR(-ENXIO);
> }
> --
> 2.42.0
>
Powered by blists - more mailing lists