diff mbox

serial: sh-sci: Fix length of scatterlist

Message ID 1445343502-4436-1-git-send-email-yoshihiro.shimoda.uh@renesas.com (mailing list archive)
State Changes Requested
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Yoshihiro Shimoda Oct. 20, 2015, 12:18 p.m. UTC
This patch fixes an issue that the "length" of scatterlist should be
set using sh_dma_length(). Otherwise, a dmaengine driver cannot work
correctly if CONFIG_NEED_SG_DMA_LENGTH=y.

Fixes: 7b39d90184 (serial: sh-sci: Fix NULL pointer dereference if HIGHMEM is enabled)
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/tty/serial/sh-sci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Geert Uytterhoeven Oct. 20, 2015, 12:22 p.m. UTC | #1
Hi Shimoda-san,

On Tue, Oct 20, 2015 at 2:18 PM, Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> This patch fixes an issue that the "length" of scatterlist should be
> set using sh_dma_length(). Otherwise, a dmaengine driver cannot work

sg_dma_len()?

> correctly if CONFIG_NEED_SG_DMA_LENGTH=y.
>
> Fixes: 7b39d90184 (serial: sh-sci: Fix NULL pointer dereference if HIGHMEM is enabled)
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
>  drivers/tty/serial/sh-sci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
> index 960e50a..284a872 100644
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -1437,7 +1437,7 @@ static void sci_request_dma(struct uart_port *port)
>                         sg_init_table(sg, 1);
>                         s->rx_buf[i] = buf;
>                         sg_dma_address(sg) = dma;
> -                       sg->length = s->buf_len_rx;
> +                       sg_dma_length(sg) = s->buf_len_rx;

There's no definition for "sg_dma_length" in my tree?? sg_dma_len()?

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
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
kernel test robot Oct. 20, 2015, 1:15 p.m. UTC | #2
Hi Yoshihiro,

[auto build test ERROR on tty/tty-next -- if it's inappropriate base, please suggest rules for selecting the more suitable base]

url:    https://github.com/0day-ci/linux/commits/Yoshihiro-Shimoda/serial-sh-sci-Fix-length-of-scatterlist/20151020-201918
config: x86_64-allmodconfig (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/tty/serial/sh-sci.c: In function 'sci_request_dma':
>> drivers/tty/serial/sh-sci.c:1440:4: error: implicit declaration of function 'sg_dma_length' [-Werror=implicit-function-declaration]
       sg_dma_length(sg) = s->buf_len_rx;
       ^
>> drivers/tty/serial/sh-sci.c:1440:22: error: lvalue required as left operand of assignment
       sg_dma_length(sg) = s->buf_len_rx;
                         ^
   cc1: some warnings being treated as errors

vim +/sg_dma_length +1440 drivers/tty/serial/sh-sci.c

  1434			for (i = 0; i < 2; i++) {
  1435				struct scatterlist *sg = &s->sg_rx[i];
  1436	
  1437				sg_init_table(sg, 1);
  1438				s->rx_buf[i] = buf;
  1439				sg_dma_address(sg) = dma;
> 1440				sg_dma_length(sg) = s->buf_len_rx;
  1441	
  1442				buf += s->buf_len_rx;
  1443				dma += s->buf_len_rx;

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Yoshihiro Shimoda Oct. 22, 2015, 6:36 a.m. UTC | #3
SGkgR2VlcnQtc2FuLA0KDQo+IFNlbnQ6IFR1ZXNkYXksIE9jdG9iZXIgMjAsIDIwMTUgOToyMiBQ
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HBlb3BsZSwgSSBjYWxsIG15c2VsZiBh
IGhhY2tlci4gQnV0DQo+IHdoZW4gSSdtIHRhbGtpbmcgdG8gam91cm5hbGlzdHMgSSBqdXN0IHNh
eSAicHJvZ3JhbW1lciIgb3Igc29tZXRoaW5nIGxpa2UgdGhhdC4NCj4gICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAtLSBMaW51cyBUb3J2YWxkcw0K
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index 960e50a..284a872 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1437,7 +1437,7 @@  static void sci_request_dma(struct uart_port *port)
 			sg_init_table(sg, 1);
 			s->rx_buf[i] = buf;
 			sg_dma_address(sg) = dma;
-			sg->length = s->buf_len_rx;
+			sg_dma_length(sg) = s->buf_len_rx;
 
 			buf += s->buf_len_rx;
 			dma += s->buf_len_rx;