From patchwork Wed Jul 10 23:09:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 13729832 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71B7F143732; Wed, 10 Jul 2024 23:09:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720652955; cv=none; b=peNZQ+BJ3BZKhdK3EaIe25ej3dxMhooAYgpl274NK0SGlUKmSXm0FuUCUmEJgn0JDmGM+wFXqjzKcqCtfRC9zNisf65KnOwb4gFMq6/6x5qZPnmOmAbZyZzxiNZJukIn9D5w/uemygcqkFD40t9R+TixAFVXGkfMdHmDeIZpK1E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720652955; c=relaxed/simple; bh=Cmjpd3UBqMGnmALQq0KMRUdneJYAdVb5qLYWbvhz/J0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TKY5AtFNqft7l/SRexmP2aLC7vUKNSZzYH9foFhhdLohSaHiLDHucLnizPXqBXoUl3Vt4IAZBTQzSOFkEElWN/yRJRoL4vD1KEippSuJ8tJ6F+WLaBblC4UczNAiJ7d6S3D9ChbFZ6FZzSkNb/fr4u+xirrISD1OGFjTVFgqiVI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JF/yIWfa; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JF/yIWfa" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E589C32781; Wed, 10 Jul 2024 23:09:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720652955; bh=Cmjpd3UBqMGnmALQq0KMRUdneJYAdVb5qLYWbvhz/J0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JF/yIWfaH19g/M5+bESbCWC/+ACvp4/8Vsnd1YVFPuiOucYB22O1dyVYR3lZs/siR VO7hS7wOkxznnNya7wHfEOKpGFMWxdTug/4mIX2yqMpxijhqz6Ve23MBC/M22RvsUo CMcweakO+l2+J/O1jjyCk6QbTH7epl/uI5hHX6Sov/9wfJf+wSdKQC4dyU3VF+375P koZ8fw2Ea0jgYIzMUuJNFnTYCArKugHxVW+AYvcZAt0ku3hPJD8ptwDmUp4qEp8ruo Nc1hmqafFxT9fm/Uc9zSGAvFZk8tBdCM0AOB7ppBB5JWgcYuJUjT5IIfS4bR6XnqhL XrI//ct6GCXMg== From: Kees Cook To: Stanimir Varbanov Cc: Kees Cook , Vikash Garodia , "Bryan O'Donoghue" , Mauro Carvalho Chehab , "Gustavo A. R. Silva" , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] media: venus: hfi_cmds: struct hfi_session_release_buffer_pkt: Replace 1-element array with flexible array Date: Wed, 10 Jul 2024 16:09:12 -0700 Message-Id: <20240710230914.3156277-1-kees@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240710230728.work.977-kees@kernel.org> References: <20240710230728.work.977-kees@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1242; i=kees@kernel.org; h=from:subject; bh=Cmjpd3UBqMGnmALQq0KMRUdneJYAdVb5qLYWbvhz/J0=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBmjxSZJHfN+D7Or0gqhRKWCoE4jDekzwc41r+25 yWWx9CezLeJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZo8UmQAKCRCJcvTf3G3A JlrBEACQ9GLgH1uh6oyt97dALDLvy+CJ5c1XPFJOMUA6rdN/sWkbL9J7DBTaM0YsYGjJTEHUJ1+ 9MMLSYpyFEOISWE2pCphkhCrddaY5FG0NvJtKYjYfkfTnuA0EPpavc0wimdaFKtgjGoqiW0EpSs 3hMFrP5D4q5Yfxg6TZU5t0JyUs9pKowCQ5OylEF6l38Nbu8EHZ1ATj2cuh/He5BSq1As3D0LR5B L08p7te1hvQAdXww/JIqL0BbaC9Tnks8woJw1WXNqRk/EFDDQWe0iv1Vl85ID2KO1k0COaO3pC8 5DruxjqyQTdYKg10qTmkf06XGkCi/ZVfYvxVCHGWnDz+8X/uQkfC7BLsIh+Nv+d+PQNJ388ijPa ag3atbD22Ok7Ddtj6ISFO2eBELGwSBPK2VopxhW2NApoYpkZIxt9W7lYQBfkylxDHHkkJ9kYfC9 d0f48hI+PQfI43dPx6KPXrFxaBJwXKDC3hABO/4r01kjt9+vZApne7/o6mF60doedgbw50GHjPx ESAx1tAhFD5lvT1pu/WYbT8dKaP56hnSDR3TJXcbH3u11/suO56bX+sMj1rq7TAwGVGdEboNlZ9 vPQVuVpXHn8uHKdx5ZjcvzPR670Y3zbLU0fuhy8KP0umtmwccfgw17rLmS4RDq9mzAxOj2fKYQ5 S0HuiiSHZz54GQA== X-Developer-Key: i=kees@kernel.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 Replace the deprecated[1] use of a 1-element array in struct hfi_session_release_buffer_pkt with a modern flexible array. No binary differences are present after this conversion. Link: https://github.com/KSPP/linux/issues/79 [1] Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Reviewed-by: Bryan O'Donoghue Reviewed-by: Vikash Garodia Reviewed-by: Dikshita Agarwal --- Cc: Stanimir Varbanov Cc: Vikash Garodia Cc: "Bryan O'Donoghue" Cc: Mauro Carvalho Chehab Cc: "Gustavo A. R. Silva" Cc: linux-media@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org Cc: linux-hardening@vger.kernel.org --- drivers/media/platform/qcom/venus/hfi_cmds.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.h b/drivers/media/platform/qcom/venus/hfi_cmds.h index 20acd412ee7b..42825f07939d 100644 --- a/drivers/media/platform/qcom/venus/hfi_cmds.h +++ b/drivers/media/platform/qcom/venus/hfi_cmds.h @@ -227,7 +227,7 @@ struct hfi_session_release_buffer_pkt { u32 extradata_size; u32 response_req; u32 num_buffers; - u32 buffer_info[1]; + u32 buffer_info[]; }; struct hfi_session_release_resources_pkt { From patchwork Wed Jul 10 23:09:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 13729833 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71C0C14BFA2; Wed, 10 Jul 2024 23:09:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720652955; cv=none; b=ik5hp8Ffopx28IAtikMpKmvoGjzIFlJDW9d9w4ALH5NerVlO6j7IPxjHKpuIoieMaqT1wyRPhP+8lUgS6rnKivVnA+DCkdpCaVwgSjp1O4f3UiLVWrzu31OtKKQWgwMeKPhExy4u/SLQNiu8MlAzyoecXAmEbF+wH5GtwT9uz2s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720652955; c=relaxed/simple; bh=iJc/bf8te2V4HIoUt6truxqDC2AFjane+tEtVaHMpDY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JGcNY8lPZLEKSON7opmVk2hdjj2NaMHJtwghS+LHqmYx9KHF9vWHhAHC6Mdrhi0uz4S8bXfsNzgqzkSfIJ/ISXkrZH9qJW0+x/LW83+VTkfXOto1PCb31TLwstK72quFiT9eNpFNGppKij/6cI6xlSEkw5nVS6tBqMDudshmv4w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kzkvWggb; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kzkvWggb" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 214FEC4AF09; Wed, 10 Jul 2024 23:09:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1720652955; bh=iJc/bf8te2V4HIoUt6truxqDC2AFjane+tEtVaHMpDY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kzkvWggbyqNQ25bBkRuzsc7yRc5uuJeLcyoqJ7BH3XhNJARf1iN49ojgIgAJ3GUVb 1sxWUQe3AA0ggfN7mskBEmkZkHHj7gac+IUx9GCGZ6tgmsYafqkRvYZQ9g2TwsCCBc 4fvvVf/Vnv0b/D41kVfp7Y944+js1nX+e3fzah1A6EOOmUsIawWd/SKgE72SMTxAEV i87wg7Zs8ynt1PmPGp7fkh8ggrGJoqXrZCcxN055x4ZnAzOcaTtEXmIkeW6Z+yvNCx BjBcnsFFU4hC9eEJcEWS81EjCe7Czl1kjK5gx4UBlXgZ1Ix/CSJtiKI9NpVWN51OEb cmvez/ieukZiQ== From: Kees Cook To: Stanimir Varbanov Cc: Kees Cook , Vikash Garodia , "Bryan O'Donoghue" , Mauro Carvalho Chehab , "Gustavo A. R. Silva" , linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] media: venus: hfi_cmds: struct hfi_session_release_buffer_pkt: Add __counted_by annotation Date: Wed, 10 Jul 2024 16:09:13 -0700 Message-Id: <20240710230914.3156277-2-kees@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240710230728.work.977-kees@kernel.org> References: <20240710230728.work.977-kees@kernel.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1278; i=kees@kernel.org; h=from:subject; bh=iJc/bf8te2V4HIoUt6truxqDC2AFjane+tEtVaHMpDY=; b=owEBbQKS/ZANAwAKAYly9N/cbcAmAcsmYgBmjxSZUawcA9Ew7IpbCfivm2IRppHC3x5DpA7ZX H5tgKkNgMGJAjMEAAEKAB0WIQSlw/aPIp3WD3I+bhOJcvTf3G3AJgUCZo8UmQAKCRCJcvTf3G3A Jq+FEACCCc+lCg8Q5cP7rKh6vLWy0J5PTf6zKb7XBrrU3GuPjXsCH5LD7ugkdRRrDQhX+bQ+6Jw 2omDkASy0fmKm30Pv8LFrK64HdQZaOUVuhLsf9iCSmY/bPiVKjycqNq+JD3a/QsbmBxVxYddqju VD+zSxn2ZYkJ/cweO3g5c15VFm8jSe0zErw7wy6hX7YPvXhoth9DqA59zrUM/Wi8VhiDY2Wl64T T7BZsLn8SaDntoVrJKi03adr7A3bMpK95J19BvEgx+L8CQme2Q35jppbE1FJ38WYKH3fgfKFcFt 65K4spkwsxXKeeNXRxO2fvmsgW9Nisq/3hcezwuiOk16ZHLPE6S5r9qa45gUNqSxMXfqc3u4VaZ NHrjOe52IGNolMbQErfkFpxAdVGSTmiTFvvKmlsF2wzZv346MmCXQyp74qx0f9p4K7SyDx/202A uM+5F+jUQsrqY4z0TKmZaWtWPXg5b11ot25DLCcltlYJ1WpKmjFOxT5o30z9gKv8jFA9O+dVrx5 vBux7ANwfQOaCmtvlvBLimsg+yrpA/rFjR/BsnJY5Vxr87s6FlMQy9Ho2Npsv2/B45ieWIoMWVU WN1WyiuKU5uX4TQHmLtVq6Nj5DYPpWvsSltg6c3a2+Hjnv3zwdKiXlCe0ZA0TRLsHSUefGLYzfv z1CAA4/gYxcrozw== X-Developer-Key: i=kees@kernel.org; a=openpgp; fpr=A5C3F68F229DD60F723E6E138972F4DFDC6DC026 The only direct user of struct hfi_session_release_buffer_pkt is pkt_session_unset_buffers() which sets "num_buffers" before using it as a loop counter for accessing "buffer_info". Add the __counted_by annotation to reflect the relationship. Signed-off-by: Kees Cook Reviewed-by: Gustavo A. R. Silva Reviewed-by: Bryan O'Donoghue Reviewed-by: Vikash Garodia Reviewed-by: Dikshita Agarwal --- Cc: Stanimir Varbanov Cc: Vikash Garodia Cc: "Bryan O'Donoghue" Cc: Mauro Carvalho Chehab Cc: "Gustavo A. R. Silva" Cc: linux-media@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org Cc: linux-hardening@vger.kernel.org --- drivers/media/platform/qcom/venus/hfi_cmds.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.h b/drivers/media/platform/qcom/venus/hfi_cmds.h index 42825f07939d..1adf2d2ae5f2 100644 --- a/drivers/media/platform/qcom/venus/hfi_cmds.h +++ b/drivers/media/platform/qcom/venus/hfi_cmds.h @@ -227,7 +227,7 @@ struct hfi_session_release_buffer_pkt { u32 extradata_size; u32 response_req; u32 num_buffers; - u32 buffer_info[]; + u32 buffer_info[] __counted_by(num_buffers); }; struct hfi_session_release_resources_pkt {