All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Sasha Levin <sashal@kernel.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	stable <stable@vger.kernel.org>,
	Biju Das <biju.das.jz@bp.renesas.com>,
	Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	Mark Brown <broonie@kernel.org>,
	linux-spi <linux-spi@vger.kernel.org>
Subject: Re: [PATCH AUTOSEL 5.16 12/13] spi: Fix invalid sgs value
Date: Wed, 16 Mar 2022 17:07:28 +0100	[thread overview]
Message-ID: <CAMuHMdVtGb6LCTbDKo9vn=1MmP+RZJTe2=VNTtrNsPa-=1Q6zA@mail.gmail.com> (raw)
In-Reply-To: <20220316141354.247750-12-sashal@kernel.org>

Hi Sasha,

On Wed, Mar 16, 2022 at 3:15 PM Sasha Levin <sashal@kernel.org> wrote:
> From: Biju Das <biju.das.jz@bp.renesas.com>
>
> [ Upstream commit 1a4e53d2fc4f68aa654ad96d13ad042e1a8e8a7d ]

This commit is not 100% correct, cfr.
https://lore.kernel.org/lkml/CAHk-=wiZnS6n1ROQg3FHd=bcVTHi-sKutKT+toiViQEH47ZACg@mail.gmail.com
Please postpone backporting until the issue has been resolved.

>
> max_seg_size is unsigned int and it can have a value up to 2^32
> (for eg:-RZ_DMAC driver sets dma_set_max_seg_size as U32_MAX)
> When this value is used in min_t() as an integer type, it becomes
> -1 and the value of sgs becomes 0.
>
> Fix this issue by replacing the 'int' data type with 'unsigned int'
> in min_t().
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Link: https://lore.kernel.org/r/20220307184843.9994-1-biju.das.jz@bp.renesas.com
> Signed-off-by: Mark Brown <broonie@kernel.org>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>  drivers/spi/spi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
> index 8ba87b7f8f1a..ed4e6983eda0 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -1021,10 +1021,10 @@ int spi_map_buf(struct spi_controller *ctlr, struct device *dev,
>         int i, ret;
>
>         if (vmalloced_buf || kmap_buf) {
> -               desc_len = min_t(int, max_seg_size, PAGE_SIZE);
> +               desc_len = min_t(unsigned int, max_seg_size, PAGE_SIZE);
>                 sgs = DIV_ROUND_UP(len + offset_in_page(buf), desc_len);
>         } else if (virt_addr_valid(buf)) {
> -               desc_len = min_t(int, max_seg_size, ctlr->max_dma_len);
> +               desc_len = min_t(unsigned int, max_seg_size, ctlr->max_dma_len);
>                 sgs = DIV_ROUND_UP(len, desc_len);
>         } else {
>                 return -EINVAL;

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2022-03-16 16:07 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-16 14:13 [PATCH AUTOSEL 5.16 01/13] arm64: dts: qcom: c630: disable crypto due to serror Sasha Levin
2022-03-16 14:13 ` [PATCH AUTOSEL 5.16 02/13] HID: logitech-dj: add new lightspeed receiver id Sasha Levin
2022-03-16 14:13 ` [PATCH AUTOSEL 5.16 03/13] HID: Add support for open wheel and no attachment to T300 Sasha Levin
2022-03-16 14:13   ` Sasha Levin
2022-03-16 14:13 ` [PATCH AUTOSEL 5.16 04/13] xfrm: fix tunnel model fragmentation behavior Sasha Levin
2022-03-16 14:13   ` Sasha Levin
2022-03-16 14:13   ` Sasha Levin
2022-03-16 14:13 ` [PATCH AUTOSEL 5.16 05/13] ARM: mstar: Select HAVE_ARM_ARCH_TIMER Sasha Levin
2022-03-16 14:13   ` Sasha Levin
2022-03-16 14:13 ` [PATCH AUTOSEL 5.16 06/13] virtio_console: break out of buf poll on remove Sasha Levin
2022-03-16 14:13   ` Sasha Levin
2022-03-16 14:13 ` [PATCH AUTOSEL 5.16 07/13] vdpa/mlx5: should verify CTRL_VQ feature exists for MQ Sasha Levin
2022-03-16 14:13   ` Sasha Levin
2022-03-16 14:13 ` [PATCH AUTOSEL 5.16 08/13] Revert "xfrm: state and policy should fail if XFRMA_IF_ID 0" Sasha Levin
2022-03-16 14:13 ` [PATCH AUTOSEL 5.16 09/13] tools/virtio: fix virtio_test execution Sasha Levin
2022-03-16 14:13   ` Sasha Levin
2022-03-16 14:13 ` [PATCH AUTOSEL 5.16 10/13] ethernet: sun: Free the coherent when failing in probing Sasha Levin
2022-03-16 14:13 ` [PATCH AUTOSEL 5.16 11/13] gpio: Revert regression in sysfs-gpio (gpiolib.c) Sasha Levin
2022-03-16 16:06   ` Linus Walleij
2022-03-16 14:13 ` [PATCH AUTOSEL 5.16 12/13] spi: Fix invalid sgs value Sasha Levin
2022-03-16 16:07   ` Geert Uytterhoeven [this message]
2022-03-16 16:40     ` Sasha Levin
2022-03-16 14:13 ` [PATCH AUTOSEL 5.16 13/13] net:mcf8390: Use platform_get_irq() to get the interrupt Sasha Levin

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='CAMuHMdVtGb6LCTbDKo9vn=1MmP+RZJTe2=VNTtrNsPa-=1Q6zA@mail.gmail.com' \
    --to=geert@linux-m68k.org \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=sashal@kernel.org \
    --cc=stable@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 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.