From patchwork Tue Apr 25 07:53:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 87283 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3246622vqo; Tue, 25 Apr 2023 01:10:47 -0700 (PDT) X-Google-Smtp-Source: AKy350YvMln8gdUakgxSFWyZICzJSpPGMG/t+gJr5TM2ltwLJT4eh/bui2hgNJJYOwQP519qv1vV X-Received: by 2002:a05:6a20:734a:b0:f2:be63:23ed with SMTP id v10-20020a056a20734a00b000f2be6323edmr15098251pzc.35.1682410247464; Tue, 25 Apr 2023 01:10:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682410247; cv=none; d=google.com; s=arc-20160816; b=WJqYUIJOqkrUSmqGMiDM1rmV+kbhwOFxX9YXas/Pqrm0eF7wbjLWjElJyL0m1cU3WO MEDqg5Rocik1qj2UUZMUvTVk79QgD/I8JghgAp80aCOCxz5OZvciki93RJaK0h/75Ek5 jusRfbvrW3I+m6N4UZUU+1TmG1amkENwZSVELKs5jQX19qDdSiIaT0sFWhiwG55Bd5nv +66E1cNras5Tq1Zpiu6+u9QSPh4U0btEP310ttIcekGx4g1VQU6vXzeb2usZvfn+paeQ xaiRuLIZiTd4MhrHYYzSIqMVZRCmzat5/tBwWdQH9oJCMhXPyC76RHxMx8zyAEqQxUA9 KxKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=5mXZM2+8CUq1MLkMg5pCYcpJ5YHT+aXC4TWjV894QWw=; b=qQzFMB/2FSP2uIf87TFkMnAysitCe/9f9qXkNtSXM+uDmjf9TuzqixhtqtfKLpnqwc pZCptFnT1aE7e6iJI6mP7yCA4c+e4il9bmgt6veJAclZr4rnVI299lE4rS9TthS9NTy6 dnczv0tqFtMGIstvJJHJybpOVulyivnfe3A7BmwcEceNMMS8MLw518CVz0GfqzMqBJGL 75Z7O+fTCd0PYRPRqOCxr2nNeiwo0RGpXhQ1aqbwjeWRvUKFYCzw/0ySMS70p4d6UVIs psfGsutk6BT4CFz4vcAMG4UuuDONIIKrDWwrqnJich4TztO9wpDhDVJ8LmZgBy82lcwQ bg4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=TnvJO9+W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk13-20020a056a02028d00b004a4eae7c943si12349225pgb.535.2023.04.25.01.10.31; Tue, 25 Apr 2023 01:10:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=TnvJO9+W; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231189AbjDYHxn (ORCPT + 99 others); Tue, 25 Apr 2023 03:53:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232854AbjDYHxk (ORCPT ); Tue, 25 Apr 2023 03:53:40 -0400 Received: from smtp.smtpout.orange.fr (smtp-23.smtpout.orange.fr [80.12.242.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CED5C9F for ; Tue, 25 Apr 2023 00:53:38 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id rDUWpfoNtvolhrDUWpTpgz; Tue, 25 Apr 2023 09:53:37 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1682409217; bh=5mXZM2+8CUq1MLkMg5pCYcpJ5YHT+aXC4TWjV894QWw=; h=From:To:Cc:Subject:Date; b=TnvJO9+WncBBDJvXwGxUGPZpoAVDCM9dCNOGEU0rqOTlm0gCl3atNvsuo/MZ8D0rH hc0nxV3G5j9dk4MjnbEt5pxtRu3a51zzcVgZfeMTyvBzTvsvj1AxTgp4ivP59Mm0x8 bKanJ+IA/L/Kx3eKki/wsL6JLYoQy/dlOeOJxG4J4y04j1lanRs8//O8NRG9KlgURY 20CRQc+UCFa85ucEXacBZQbNhRusWfHXpxn9PfQP84aFcZSoEV2jbnfW0vHdun4dpF 1DSX9oeWmHjOJ25XWrYw+0p17UkCu0dT4oyE3FMZLHjSAxnNTE4pAjHCH4IF1g3u1v xLNqU7hYp7wzw== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 25 Apr 2023 09:53:37 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Harry Wentland , Leo Li , Rodrigo Siqueira , Alex Deucher , =?utf-8?q?Christian_K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH] drm/amd/display: Correctly initialize some memory in get_available_dsc_slices() Date: Tue, 25 Apr 2023 09:53:34 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764135007812872368?= X-GMAIL-MSGID: =?utf-8?q?1764135007812872368?= The intent here is to clear the 'available_slices' buffer before setting some values in it. This is an array of int, so in order to fully initialize it, we must clear MIN_AVAILABLE_SLICES_SIZE * sizeof(int) bytes. Compute the right length of the buffer when calling memset(). Fixes: 97bda0322b8a ("drm/amd/display: Add DSC support for Navi (v2)") Signed-off-by: Christophe JAILLET --- NOT even compile-tested. make -j7 drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.o on my setup, it fails with: CC drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.o drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c:27:10: fatal error: dc_hw_types.h: Aucun fichier ou dossier de ce type 27 | #include "dc_hw_types.h" | ^~~~~~~~~~~~~~~ I've not investigated why. --- drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c b/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c index b9a05bb025db..1d7384b2be28 100644 --- a/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c +++ b/drivers/gpu/drm/amd/display/dc/dsc/dc_dsc.c @@ -645,7 +645,7 @@ static int get_available_dsc_slices(union dsc_enc_slice_caps slice_caps, int *av { int idx = 0; - memset(available_slices, -1, MIN_AVAILABLE_SLICES_SIZE); + memset(available_slices, -1, MIN_AVAILABLE_SLICES_SIZE * sizeof(*available_slices)); if (slice_caps.bits.NUM_SLICES_1) available_slices[idx++] = 1;