Linux MHI Development
 help / color / mirror / Atom feed
From: Manivannan Sadhasivam <mani@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Hemant Kumar <hemantk@codeaurora.org>,
	Alex Elder <elder@linaro.org>,
	mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] bus: mhi: ep: Fix signedness bug in mhi_ep_register_controller()
Date: Mon, 7 Mar 2022 20:39:16 +0530	[thread overview]
Message-ID: <20220307150916.GO12451@workstation> (raw)
In-Reply-To: <20220307142822.GC19660@kili>

On Mon, Mar 07, 2022 at 05:28:22PM +0300, Dan Carpenter wrote:
> The "mhi_cntrl->index" variable is unsigned so the error handling will
> not work.
> 
> Fixes: 10f0ab9c6787 ("bus: mhi: ep: Add support for registering MHI endpoint controllers")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks for the fix! The fix was already added to mhi-next (squashed) as a
response to the previous report.

https://lore.kernel.org/mhi/20220307071739.GM12451@workstation/T/#t

Thanks,
Mani

> ---
>  drivers/bus/mhi/ep/main.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/bus/mhi/ep/main.c b/drivers/bus/mhi/ep/main.c
> index 3e98107f08c4..879071b021d5 100644
> --- a/drivers/bus/mhi/ep/main.c
> +++ b/drivers/bus/mhi/ep/main.c
> @@ -1418,11 +1418,10 @@ int mhi_ep_register_controller(struct mhi_ep_cntrl *mhi_cntrl,
>  	mhi_ep_mmio_set_env(mhi_cntrl, MHI_EE_AMSS);
>  
>  	/* Set controller index */
> -	mhi_cntrl->index = ida_alloc(&mhi_ep_cntrl_ida, GFP_KERNEL);
> -	if (mhi_cntrl->index < 0) {
> -		ret = mhi_cntrl->index;
> +	ret = ida_alloc(&mhi_ep_cntrl_ida, GFP_KERNEL);
> +	if (ret < 0)
>  		goto err_destroy_wq;
> -	}
> +	mhi_cntrl->index = ret;
>  
>  	irq_set_status_flags(mhi_cntrl->irq, IRQ_NOAUTOEN);
>  	ret = request_irq(mhi_cntrl->irq, mhi_ep_irq, IRQF_TRIGGER_HIGH,
> -- 
> 2.20.1
> 

      parent reply	other threads:[~2022-03-07 15:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07 14:28 [PATCH] bus: mhi: ep: Fix signedness bug in mhi_ep_register_controller() Dan Carpenter
2022-03-07 14:50 ` Alex Elder
2022-03-07 14:53   ` Dan Carpenter
2022-03-07 15:09 ` Manivannan Sadhasivam [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=20220307150916.GO12451@workstation \
    --to=mani@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=elder@linaro.org \
    --cc=hemantk@codeaurora.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=mhi@lists.linux.dev \
    /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