Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1263489lqj; Mon, 3 Jun 2024 16:02:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW5RgGvhHBTVHZXY/EqPDaspevJDJaDSnPmQEZcqhf17TZEV1EOmGQ0rtMmWiUv26qDbNx3vMTAYtS/I7Aw1CBX+qUDWqK0uL3SLkbqbA== X-Google-Smtp-Source: AGHT+IH9w4Rn/UbNEtXPZp3yRoJ7fqJUhJ7i+QOSUgM9NHonkZQ3hoyHLUrh6J2b9brgNegnBuho X-Received: by 2002:ad4:4b6e:0:b0:6ae:d2ca:68dd with SMTP id 6a1803df08f44-6aed2ca68e3mr85941806d6.6.1717455741986; Mon, 03 Jun 2024 16:02:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717455741; cv=pass; d=google.com; s=arc-20160816; b=mtPcSpHFGPfxHV211aJvo00zWa/LitsvRv/Wd44HpJB0FuiepzqsivBa5prooJChXu CYAVx+7IH9WJfUFKEXsD4VVTH9lHFXz0cDZgIk9z813gaInDtRq5tL9PRnRvyv+fMypJ Kk8XRE0ERucpH+ip2F/0IMzzJE6c/VTUFTGuZg44wK91eMOxKL4wuFzWMPPy8KQs5ium SgHpTDa9gXIkM02OnbtOZePzdUDMPntLVEkFnA0YBhm+ClzXr6ZoSQAwDOBhTpjYztLC u1C7n+gbScsBY/u3knnmRVo/qm9QnPDlMenE9beAuALYpI/lh+t0r87R00NKUMSI0j06 UXzQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=kSyt1luXPfolxaJFzIiXo2v2aq7LyOeBXFD6yzHDT/c=; fh=kRqEtKnFPv3fUpnMsoHONgHHUvgHpBELOFRjTTvgTOA=; b=lJ6j4ODMOYZR0IsPEj6364mZwhxOI/inOyyN2ZdE6uUlOu9svzaOSX3H4DNsrInaVv 6I62bGnNNrs9evBOZazVugsHERCXKcsZXFK0EUB2X2W4IvIi0/8tsGz4OjfDkBdpDgBH LKj/o30Vdo9D0W8gas7UjgrXMUw0w5UQb9vWaQYDR8iITRf5w8TExEbqky85cUa3iUDJ NQ0s5csMk9M4H/IkFzOZs4ybPc1kvFI/oZJcdkhOPeXnk9zp80YG6CHvnc+Q4fwO5iHe EswNoSC60GiuvIym+6V02+0AoTjsr0vlA8KUrBA5OnY6SmtALJ9ifjdBWAkErYUQydX5 s4DA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UbXLYWI2; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-199804-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199804-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4b401a86si95749546d6.208.2024.06.03.16.02.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 16:02:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199804-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UbXLYWI2; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-199804-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199804-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A64541C23514 for ; Mon, 3 Jun 2024 23:02:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D20E13CFA3; Mon, 3 Jun 2024 23:02:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="UbXLYWI2" Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67CF571747 for ; Mon, 3 Jun 2024 23:02:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.67 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717455733; cv=none; b=b4MCq23MwoDjeAq+0Nlkks0b0+hiH0j//AzLpeglv9N/bL3dt3Cl+Cq5/d3w1IvrAn8APzhaAmi6OwGZrM1HadlSLbtH6DiDLo7uc5ESo2dZGRy+qJz4z3Zu6F5jKmwhLEOJLHRrRFcihhuXQFgcquWiY+Hv0QvaPaY1CYHKluY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717455733; c=relaxed/simple; bh=0jZi6KDIf1K2W/UDkvFfqguppsND1IA8K+Mx7olaYcw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=UpvA90qQsU1FmzleN5yAk4+13+o2GnKEZW5xdcaf07P+LKwDZ89YHQl1nFR0i8bJFxYqBR2qNxlAx8DQE7nSEEFojldVkni2i7reG6ATbEoBPme+aoZcrc+wQ9PP2MdjCBcFxNGrTJ0D2HqeG8+FTXyvW+o3mg67krCicTzYsw4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=UbXLYWI2; arc=none smtp.client-ip=209.85.128.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wm1-f67.google.com with SMTP id 5b1f17b1804b1-421396e3918so24616625e9.0 for ; Mon, 03 Jun 2024 16:02:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717455730; x=1718060530; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=kSyt1luXPfolxaJFzIiXo2v2aq7LyOeBXFD6yzHDT/c=; b=UbXLYWI2bSmCik3AfdH4ORblsXmoxXBJdygmzYrHyxZzDRHcXc3ND10OD1CydyK0Em avASTW01PwupE6iA+h7KDWWbg9/hcIgjIF0VpZvaa6LvBEJsL186abIhVfKJzC4ITsoK vazI+DeU9oi2DnnkkGrlOLOsvNjeex4ac8Lqj5bTOiHvYTnJdYC8VQiVfDFwPsgLJw/L 4MAPey1diXt1vn0wVlI8P/B+i8LNdZwY8htjcwIU1QHDSReoxz+ZlBQDlcTbyuDq+u5h pIIwdmQsCIPs4nt1iRNUcxb9Qoe1wjcOaYVIpjFULQXa46SvqL37XsO4rhjKG7wfcurz zIkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717455730; x=1718060530; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kSyt1luXPfolxaJFzIiXo2v2aq7LyOeBXFD6yzHDT/c=; b=xEa2zNeqt/x1JFv8ffglDc55JjDhvIYSGwlN39AJ9DM85cnuHdepyr05EAoVg+9E0T cRbSivehBPm7Rq+cqExqlIBmTZ3IEHY6o5OLheSOGEa2HbuGQlRgKFjdAdFffLfCE96V wz/g3fLz44XEtTGIJXfsQI/1MUF+A12KpVL4aEQimxoMpRX9QeiaNBR9xKCbQa/Ko60t 1kEBTQwWrm6stnFK5ui11e/0GWXFEG71N8h3FphiS5A94HrpWldMtVCG0E/I78LV/gRM L8m+0Nce+BvnaOETXZllQElqw/5MU36kN/kYvFbN1NW6/83YW6A18tWo+pBrltcLpjKK HTXQ== X-Gm-Message-State: AOJu0Yy615vA0klkS6358O2GZ1h4XY0/YVtG8ebgzV0XhnVKQPxkvMMQ 1nvZLjZMiSEifj0Q/DB1w+PuyjkqTSuFcLVH9+Umc5AtKu0VmXgT6Bv1ufwG4AU= X-Received: by 2002:a05:600c:4f0f:b0:41b:f116:8868 with SMTP id 5b1f17b1804b1-4212e0502e7mr105289885e9.12.1717455729708; Mon, 03 Jun 2024 16:02:09 -0700 (PDT) Received: from [192.168.0.3] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4214ecbb563sm82895e9.21.2024.06.03.16.02.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Jun 2024 16:02:09 -0700 (PDT) Message-ID: <0d254b5e-0dcf-41c2-949e-2edd880b2de6@linaro.org> Date: Tue, 4 Jun 2024 00:02:08 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] media: venus: Constify struct dec_bufsize_ops and enc_bufsize_ops To: Christophe JAILLET , Stanimir Varbanov , Vikash Garodia , Bryan O'Donoghue , Mauro Carvalho Chehab Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org References: <9bc4b24a55c42fa49125cae0304c8b0f208550b1.1717313173.git.christophe.jaillet@wanadoo.fr> Content-Language: en-US From: Bryan O'Donoghue In-Reply-To: <9bc4b24a55c42fa49125cae0304c8b0f208550b1.1717313173.git.christophe.jaillet@wanadoo.fr> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 02/06/2024 15:27, Christophe JAILLET wrote: > "struct dec_bufsize_ops and "struct enc_bufsize_ops" are not modified in > this driver. > > Constifying these structures moves some data to a read-only section, so > increase overall security. > > On a x86_64, with allmodconfig: > Before: > text data bss dec hex filename > 12494 822 0 13316 3404 drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.o > > After: > text data bss dec hex filename > 12766 566 0 13332 3414 drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.o > > Signed-off-by: Christophe JAILLET > --- > Changes in v2: > - Add missing prefix in the subject > > v1: https://lore.kernel.org/all/9bc4b28a55c42fa4a125c3e03d4c8b0f208550b4.1717313173.git.christophe.jaillet@wanadoo.fr/ > > While looking at lore to find the reference above, I found that this > patch had already been sent by Rikard Falkeborn > See: https://lore.kernel.org/all/20211212123534.4473-1-rikard.falkeborn@gmail.com/ > > So, if applied, credits should be for him. > So feel free to add a Co-Developed-by:, Reported-by:, Suggested-by: or > whatever makes sense, including removing my Signed-off-by: to put his if > it sounds better to do it this way. > > .../platform/qcom/venus/hfi_plat_bufs_v6.c | 20 +++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > > diff --git a/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c b/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c > index f5a655973c08..6289166786ec 100644 > --- a/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c > +++ b/drivers/media/platform/qcom/venus/hfi_plat_bufs_v6.c > @@ -1063,51 +1063,51 @@ struct enc_bufsize_ops { > u32 (*persist)(void); > }; > > -static struct dec_bufsize_ops dec_h264_ops = { > +static const struct dec_bufsize_ops dec_h264_ops = { > .scratch = h264d_scratch_size, > .scratch1 = h264d_scratch1_size, > .persist1 = h264d_persist1_size, > }; > > -static struct dec_bufsize_ops dec_h265_ops = { > +static const struct dec_bufsize_ops dec_h265_ops = { > .scratch = h265d_scratch_size, > .scratch1 = h265d_scratch1_size, > .persist1 = h265d_persist1_size, > }; > > -static struct dec_bufsize_ops dec_vp8_ops = { > +static const struct dec_bufsize_ops dec_vp8_ops = { > .scratch = vpxd_scratch_size, > .scratch1 = vp8d_scratch1_size, > .persist1 = vp8d_persist1_size, > }; > > -static struct dec_bufsize_ops dec_vp9_ops = { > +static const struct dec_bufsize_ops dec_vp9_ops = { > .scratch = vpxd_scratch_size, > .scratch1 = vp9d_scratch1_size, > .persist1 = vp9d_persist1_size, > }; > > -static struct dec_bufsize_ops dec_mpeg2_ops = { > +static const struct dec_bufsize_ops dec_mpeg2_ops = { > .scratch = mpeg2d_scratch_size, > .scratch1 = mpeg2d_scratch1_size, > .persist1 = mpeg2d_persist1_size, > }; > > -static struct enc_bufsize_ops enc_h264_ops = { > +static const struct enc_bufsize_ops enc_h264_ops = { > .scratch = h264e_scratch_size, > .scratch1 = h264e_scratch1_size, > .scratch2 = enc_scratch2_size, > .persist = enc_persist_size, > }; > > -static struct enc_bufsize_ops enc_h265_ops = { > +static const struct enc_bufsize_ops enc_h265_ops = { > .scratch = h265e_scratch_size, > .scratch1 = h265e_scratch1_size, > .scratch2 = enc_scratch2_size, > .persist = enc_persist_size, > }; > > -static struct enc_bufsize_ops enc_vp8_ops = { > +static const struct enc_bufsize_ops enc_vp8_ops = { > .scratch = vp8e_scratch_size, > .scratch1 = vp8e_scratch1_size, > .scratch2 = enc_scratch2_size, > @@ -1186,7 +1186,7 @@ static int bufreq_dec(struct hfi_plat_buffers_params *params, u32 buftype, > u32 codec = params->codec; > u32 width = params->width, height = params->height, out_min_count; > u32 out_width = params->out_width, out_height = params->out_height; > - struct dec_bufsize_ops *dec_ops; > + const struct dec_bufsize_ops *dec_ops; > bool is_secondary_output = params->dec.is_secondary_output; > bool is_interlaced = params->dec.is_interlaced; > u32 max_mbs_per_frame = params->dec.max_mbs_per_frame; > @@ -1260,7 +1260,7 @@ static int bufreq_enc(struct hfi_plat_buffers_params *params, u32 buftype, > struct hfi_buffer_requirements *bufreq) > { > enum hfi_version version = params->version; > - struct enc_bufsize_ops *enc_ops; > + const struct enc_bufsize_ops *enc_ops; > u32 width = params->width; > u32 height = params->height; > bool is_tenbit = params->enc.is_tenbit; Reviewed-by: Bryan O'Donoghue