From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA995C433E6 for ; Fri, 28 Aug 2020 12:36:50 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 90B422078A for ; Fri, 28 Aug 2020 12:36:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="yycLAIEA"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="a+SjzJaG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 90B422078A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=xRp3Mg4imAp8pq00S7cYHZsFoFbGCCFN1fmLswAQAaM=; b=yycLAIEAxW8qIViB31wF42HjO YVuWO6Fi4IOfgjAxg1z0z8rR/AIMkcu3GpDemLJe/9VjbYlJJyZwv93YrHRxT8Gly1aciT/uPL18O laKKctlntYZ1AGPCzPy0aSJ989aeag3ZdNyupMHSWae9iEE4qjG78kq0BvUzoHwPr7wSYVmhuQ6hG Rgui4Crk6t6R2v8kb5sxURbTUb64N3kswrLQ1oLE4Vq79WIsRNHYChUBeIhxBLRq0AAl7uhKGdCbf 1zdNI3S3hLKryJ1Nv6oZwBKOTB6CEpxyqRyH0Rehr9ikt2JpL4ubQmo1g7yBvYrx8AoBtjkOqNmyY coUyfsQCg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kBdbS-0004gc-Ax; Fri, 28 Aug 2020 12:35:34 +0000 Received: from mail-ed1-x541.google.com ([2a00:1450:4864:20::541]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kBdbP-0004fK-Iw for linux-arm-kernel@lists.infradead.org; Fri, 28 Aug 2020 12:35:32 +0000 Received: by mail-ed1-x541.google.com with SMTP id n13so1004426edo.10 for ; Fri, 28 Aug 2020 05:35:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S/FP18GdeEsQIBGpdNuuhDRuibofRXoQRIPNbtt9sRY=; b=a+SjzJaGpDMjLFI4m4bUgdWkdHu18yc5GfL5js7fSMQWXUvk4ovchSKQSVfpyvzLD6 0SDxmQiEQ9kVtcsheYiiZKY6taD2YxkRjcEwE0AphlIZMLmLMa/dk64bO48yD3Pc/zLS Ss1WsveDreGhDW30tSFaUkOqsbU4VuzFLHdwX42U3ocu1otvjbqeOMBlwoZaSPR6+hai 38Thk1IWapK/hXEe6Q9jxSy2N64dY/APbPpDVmxqLutGChiOE8FH4nBulsyrjEQLVfn1 RoOhwfAg8eYJFfl3uVBo9LAlxZA7aBpDF259nwmGTpbKG51bo0NOUusd5EemqUPMXqtl nvrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S/FP18GdeEsQIBGpdNuuhDRuibofRXoQRIPNbtt9sRY=; b=qTma+CH/nYIHoGvnrv1HaRImALseMj3+enYfonXemtC6OoogxWA7bEvYdgX/1qvrHy +9LtI5pKXykWvz53qcGnsv0hf0SmRUb0KpjAf4A0xyMLO0IcKeaUG+I6yxZQCP/GYtq4 lGmjVZpFcDYkDxgCPVsiModoy/a/wxmJ5E2/TS20qbHsRyItS92TsZpCaoe+j3QMWOo5 eS3FSzUXOv3+od5Vyw6jOoevi9HYLu52RpsNABquEtog/0oGlsyI5ytAd6ExiWUCqSfy FDo/ipTrn480riVRWeFSZ0WL5wk6ROXIJb0HYj1tKZMr3amopAfso42Z7yfxU5iqs2/8 swsw== X-Gm-Message-State: AOAM530Vz4q5Md1KkpwR7cJ5HHVPa+05AK+lYNxBxW7abkDOpQpKVIPP LCOk3abxud2rbHalX7bpAaI= X-Google-Smtp-Source: ABdhPJy6QQInAfaYYn6sA/5SFfqm16o4ELO1cDSV915jWO7sE29ZtFz1Iutso4lgZ0ROGcfIMaDSpQ== X-Received: by 2002:a05:6402:2285:: with SMTP id cw5mr1614748edb.242.1598618128648; Fri, 28 Aug 2020 05:35:28 -0700 (PDT) Received: from jernej-laptop.localnet (89-212-178-211.dynamic.t-2.net. [89.212.178.211]) by smtp.gmail.com with ESMTPSA id l23sm760431eje.46.2020.08.28.05.35.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 05:35:27 -0700 (PDT) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: linux-sunxi@googlegroups.com Subject: Re: [linux-sunxi] [PATCH] drm/sun4i: Fix dsi dcs long write function Date: Fri, 28 Aug 2020 14:35:26 +0200 Message-ID: <1872601.C7yQfbK89F@jernej-laptop> In-Reply-To: <20200828112444.916455-1-megous@megous.com> References: <20200828112444.916455-1-megous@megous.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200828_083531_689993_70D1ECBC X-CRM114-Status: GOOD ( 17.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: megous@megous.com, David Airlie , open list , "open list:DRM DRIVERS FOR ALLWINNER A10" , Chen-Yu Tsai , Maxime Ripard , Daniel Vetter , "moderated list:ARM/Allwinner sunXi SoC support" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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") 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. Reviewed-by: Jernej Skrabec 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); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel