Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp1170719pxa; Fri, 28 Aug 2020 05:53:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2Kr+A8orWlijUV9Zm5lJdJRLT0jfqHvuajNZwhw137jMcBHggILOMhrAgQpTC3YSjRceP X-Received: by 2002:a50:e70e:: with SMTP id a14mr1655931edn.93.1598619196824; Fri, 28 Aug 2020 05:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598619196; cv=none; d=google.com; s=arc-20160816; b=mOLIhH55EB+YXxeoiQ4aJVWBUxB+WxMemneeir61xMGJqL/k1wNU+ZJ1yqW/A67xQa FiMBnst++BJwYl+m+7u2tSSgojRVO5B9jAJaxbtOh5NnmxX4KQJcGxOjYdlvf9+oTRJB qEBmFfGvre8y+wApWWuHhhW2jqX4whSUmqzNXeNsbQ5PnmGiuAImJKgfFFQT7jM7YjM8 cC003YaBeskJ4Z6N7Eq+1mdXuDK2wJPAX1QrDhP3Ps0OzAyR8+wj7jDyfLCp2bJem688 TFMmp8eeWUtM5pYa1IRCGQ/6x1o9n1cZF2jKhl2niMsM7/c936jUdWqHqJ8qjPzVOkTx 069Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=EJST8l3l7oN0ij7pHz2BijOaUwIQkQ+d7hGBLWbCiQA=; b=APmSjXlz8lYwQWHhBgtvmf6Ci0Ure2BDwMwm/4Mwm03S4vjrYCcebYPMJGNDz+i0z4 wsES+OK4Fk/hOkdPT7HkqsI1KuzvHWdumq6bt8k3u+1UDWOWayyvOjsHVUVGiLHZeZiy 3uMaC/V8FxSu6jFP8DX4+8W1oWTYBOoIcnRPsmrJa9JHNuBfuxZ88TMYLML4IsyzzqV7 wwLUWCZrAOgJ+uYjnEh62uxazBy8A+XwRmrnqTVSudnX5FtIoH6m2E8c7PUjOXR/Gnxx KPugoAdizIIrQZLctLy+qfGfljAv+gT1vm/Xf0szHSXhdJcc/zzQ9iNH7hM8Q4PP5Cqo 97sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@megous.com header.s=mail header.b=BPsdoeAD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=megous.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p8si493382edw.437.2020.08.28.05.52.53; Fri, 28 Aug 2020 05:53:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@megous.com header.s=mail header.b=BPsdoeAD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=megous.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729426AbgH1Mv3 (ORCPT + 99 others); Fri, 28 Aug 2020 08:51:29 -0400 Received: from vps.xff.cz ([195.181.215.36]:39480 "EHLO vps.xff.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729172AbgH1Mv0 (ORCPT ); Fri, 28 Aug 2020 08:51:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1598619084; bh=N9amwtbHh9BlB74+6QxsJWuhe5/JoCauR4xTJEk0UA0=; h=Date:From:To:Cc:Subject:References:X-My-GPG-KeyId:From; b=BPsdoeADRZs+yB6e9Gp4IQIZOL9VVePGL0NPeK6769CkWS0kvp+/ee5CbcphvNK2k oCk0AfbKWRHIJn7mLBVUB/vEl1eMb0c49boJXaH3DSNIcfIHpC/gtUF9ZCrKrQ9P12 R1neKfZhDV+wCqMqiFdQj+XZPu5aqlWd9UVjHhlQ= Date: Fri, 28 Aug 2020 14:51:24 +0200 From: =?utf-8?Q?Ond=C5=99ej?= Jirman To: Jernej =?utf-8?Q?=C5=A0krabec?= Cc: linux-sunxi@googlegroups.com, Maxime Ripard , Chen-Yu Tsai , David Airlie , Daniel Vetter , "open list:DRM DRIVERS FOR ALLWINNER A10" , "moderated list:ARM/Allwinner sunXi SoC support" , open list Subject: Re: [linux-sunxi] [PATCH] drm/sun4i: Fix dsi dcs long write function Message-ID: <20200828125124.mgqforbmrjjee7gj@core.my.home> Mail-Followup-To: =?utf-8?Q?Ond=C5=99ej?= Jirman , Jernej =?utf-8?Q?=C5=A0krabec?= , linux-sunxi@googlegroups.com, Maxime Ripard , Chen-Yu Tsai , David Airlie , Daniel Vetter , "open list:DRM DRIVERS FOR ALLWINNER A10" , "moderated list:ARM/Allwinner sunXi SoC support" , open list References: <20200828112444.916455-1-megous@megous.com> <1872601.C7yQfbK89F@jernej-laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1872601.C7yQfbK89F@jernej-laptop> X-My-GPG-KeyId: EBFBDDE11FB918D44D1F56C1F9F0A873BE9777ED Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 28, 2020 at 02:35:26PM +0200, Jernej Škrabec wrote: > Dne petek, 28. avgust 2020 ob 13:24:44 CEST je Ondrej Jirman napisal(a): > > It's writing too much data. regmap_bulk_write expects number of > > register sized chunks to write, not a byte sized length of the > > bounce buffer. Bounce buffer needs to be padded too, so that > > regmap_bulk_write will not read past the end of the buffer. > > > > Signed-off-by: Ondrej Jirman > > Fixes: 133add5b5ad4 ("drm/sun4i: Add Allwinner A31 MIPI-DSI controller > support") It doesn't really fix anything user visible though, and will not help the stable branch in any way. It just makes the code more correct. Though now that you came up with the tag, copypasting it is not that much work. ;) So I added it. > should be added. Fix will be then automatically picked into stable releases. > > Small nit below. > > > --- > > drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c > > b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 7f13f4d715bf..840fad1b68dd > > 100644 > > --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c > > +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c > > @@ -889,7 +889,7 @@ static int sun6i_dsi_dcs_write_long(struct sun6i_dsi > > *dsi, regmap_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(0), > > sun6i_dsi_dcs_build_pkt_hdr(dsi, msg)); > > > > - bounce = kzalloc(msg->tx_len + sizeof(crc), GFP_KERNEL); > > + bounce = kzalloc(msg->tx_len + sizeof(crc) + 3, GFP_KERNEL); > > It would be nicer to use ALIGN() macro, but I'm fine either way. Nice idea. > Reviewed-by: Jernej Skrabec Thanks. :) regards, o. > Best regards, > Jernej > > > if (!bounce) > > return -ENOMEM; > > > > @@ -900,7 +900,7 @@ static int sun6i_dsi_dcs_write_long(struct sun6i_dsi > > *dsi, memcpy((u8 *)bounce + msg->tx_len, &crc, sizeof(crc)); > > len += sizeof(crc); > > > > - regmap_bulk_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(1), bounce, > len); > > + regmap_bulk_write(dsi->regs, SUN6I_DSI_CMD_TX_REG(1), bounce, > > DIV_ROUND_UP(len, 4)); regmap_write(dsi->regs, SUN6I_DSI_CMD_CTL_REG, len + > > 4 - 1); > > kfree(bounce); > > > >