Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1263295lqj; Mon, 3 Jun 2024 16:02:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXVGeD/HDYIwkHEXqKMUwKSWZmBHYS43MsESZikWZUO8wu64CVJpxfEiFdGmk3x8gH/k9DCDkV4UKykguJVHYEcbgTrMKZulHCbw1FUjA== X-Google-Smtp-Source: AGHT+IH01DYYGaqMVrhojSDS6bF5DpRRkbs66LAXQQuPXMq9xT2tjJhgRb2oIoEgrkNF1tYZIilJ X-Received: by 2002:a50:d719:0:b0:578:881e:7b77 with SMTP id 4fb4d7f45d1cf-57a36402ceemr8381729a12.34.1717455720191; Mon, 03 Jun 2024 16:02:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717455720; cv=pass; d=google.com; s=arc-20160816; b=0wGZWZJx1i/6gfkxdtRYyCTU1pRdbPD8PxwM6mIzMGNwyYKskKuevk0asqCqIJUxV4 F1JTZUksuaHhx4Z4tWhTC/XV1SK76grdELg+d4VyGylZRo/cMp/E4V5d6K7qSbUdZtX1 L5GQwmxlmcLM9ehgrsOETzXcyy/zFXSSXnAaC9zGHO5M3y1vtOXqyAo0SIq7dSmcKeAB FJ8qAzdIyyLzwuax9+FB97/059Y2K71BX55NY1ZLx0R605D7uVCXU0SEVQP4Big1Wrxq i3jw1n9/sFI9RORAgeyuUd4Vk7bNl8raV4y5GGZwkPYhHjNoNHKxg/jlS8A9lqdR1ylP 34Mw== 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=J1iDRH/Hpo3TypBtE8AeJr13ufvedDoMcC4PukyspSI=; fh=kRqEtKnFPv3fUpnMsoHONgHHUvgHpBELOFRjTTvgTOA=; b=NkVm98UXiGHzk3L+a+JmFvvHmWz3WGFIvjvyjvhYpvPAmE3nO4uSsJ/ZYpLCZNq0kf LceBfTDF/ugRN/h48ZKWC1p8NNGUAixe5Z07PZE+dK+Va9WhOKi2Rprbpzm+Pykdq2sE 85m/v3nFHPpRs2I9lZMmq9cZURzFi0O6Za7IDg4IXEwg1RZLLIMAxJY7v4+DzoErzvJo C2WKA7RI/NmPste9z+nxOYFnMczRzktMYhue91nvqe6LWJvYxJ2ZROdAsr/q2UXdfsr1 azUpDHblLSYHU9QJgDoHrOnFGy2amM2M5ODSBOvyrwv5gF2rQGEmTOFOa8zOAMKA/1/B Jmhg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C2ztZNZC; 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-199803-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199803-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57a31b81085si4623963a12.79.2024.06.03.16.02.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 16:02:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-199803-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C2ztZNZC; 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-199803-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-199803-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 am.mirrors.kernel.org (Postfix) with ESMTPS id BCF0A1F22926 for ; Mon, 3 Jun 2024 23:01:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9683913CFA1; Mon, 3 Jun 2024 23:01:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="C2ztZNZC" Received: from mail-wm1-f68.google.com (mail-wm1-f68.google.com [209.85.128.68]) (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 EB1871DDD6 for ; Mon, 3 Jun 2024 23:01:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.68 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717455703; cv=none; b=OVCY0fMdBco0o9VIDc5J7/NotUzs6igpWwDhBGR2EBaF27+TV71OAAX6GYT/76xfP2N+fOLT5+YOrLHCm7ZkLLU1VhjZWV0UlvZw21irOzwe2BQTnA2caPxgM5sRKjGwUbilOwoBYpg/kEsQ0ZQXCm1W1fpzeohDmEppkFpt3S0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717455703; c=relaxed/simple; bh=Qo4ylDWHCKBDpGUaTOGShTLPUnG4DbAeLHxJqlni0ow=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Qm7We16TFgakMik+RmxPyvi7YOiqRRx00qS0Dn2pYdd9zMZNY5I5UKHvTo/FxvXbEipfCqtk5L9xaoCVIEPyuhUwRUEhKKDaLX60NoL3WDHzqzm+E51Rx1ytCG6t061qtVtrlywZEv5FsgbHNk2WKU/eurXFoTaej2YZaNTxEKw= 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=C2ztZNZC; arc=none smtp.client-ip=209.85.128.68 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-f68.google.com with SMTP id 5b1f17b1804b1-42134bb9677so34569235e9.2 for ; Mon, 03 Jun 2024 16:01:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717455700; x=1718060500; 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=J1iDRH/Hpo3TypBtE8AeJr13ufvedDoMcC4PukyspSI=; b=C2ztZNZCliIs/ZSrT0hzV+VF8GvWpLoGQ13vy/3jlPsSvoyv3EV+ltI/UobKPwcwjs OoV7fbEcFIuMyaq8rl0FFMVndVzGXF7dYkHyg9xECmgHcbjJp/AyP0a88Ofx8/wjxhzp vdQmQ7VFWqsxfwnRc0qEDb7NpvW7h3h/ECLOMgQEcDxigXHeO7CmUkaVvnS5jQhCuBym L/wN/kwOxF8s1/60cFZCxlqWttfLdpgqoCqDyLBjjaTJB9enP9JVhBOlrnkk78tpedKz t8kYMBnYQKAsE/2USsdCYW3vbYYjL8Vi4ydrr7SF2mOBl1TAsiWNoJCZRM4N934+NGUS 91Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717455700; x=1718060500; 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=J1iDRH/Hpo3TypBtE8AeJr13ufvedDoMcC4PukyspSI=; b=uUlubyeCrITnwa++48VgaDB5hwNUls8SF2Gx7wOv29YByCzKWUv4BBrAoQxcbvs0D7 Y1vgS5cWyBkxMl+QeKRUH+ZbcOToiniVZ/LG2d77Nv7RdL5A/vINEn9iWRTE+NMlCo05 0QgdpF05C/njcBAnch5ANcK03ToZRe36rTYQXOUZqTw0KSP1lJB55gMgDAoxVPch9gxb tYLDLvLFvj5M09iA16mhxJPw2b7SuYFkSWdduW5FnDMeeYwL59V8oxNy9obGcrwt4b0K HDsS3rXM2LMOWZza6uB2V1R7yHtRyJePV+T+5w7vPd/Mu8tIYh+DAxIqHkERM+jsmeYL KZzA== X-Gm-Message-State: AOJu0YwV68DUJ+3x2uqqrQieAA3zLhcx5wFgQDIQNe0aRIUygUCPdnkO +8BG4YukSCUAMOM919Rzn0XzSabrQFSrFJHjPDQj2fCjbz79SySy+kz9p3G2n8g= X-Received: by 2002:a05:600c:5248:b0:421:4ecb:bd68 with SMTP id 5b1f17b1804b1-4214ecbbf7amr132595e9.31.1717455700327; Mon, 03 Jun 2024 16:01:40 -0700 (PDT) Received: from [192.168.0.3] ([176.61.106.227]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42129de0cf9sm148954215e9.13.2024.06.03.16.01.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Jun 2024 16:01:39 -0700 (PDT) Message-ID: Date: Tue, 4 Jun 2024 00:01:38 +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] 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: <9bc4b28a55c42fa4a125c3e03d4c8b0f208550b4.1717313173.git.christophe.jaillet@wanadoo.fr> Content-Language: en-US From: Bryan O'Donoghue In-Reply-To: <9bc4b28a55c42fa4a125c3e03d4c8b0f208550b4.1717313173.git.christophe.jaillet@wanadoo.fr> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 02/06/2024 08:26, 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 > --- > .../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