From patchwork Tue Oct 13 15:12:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10055 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 2A43EBEEDF for ; Tue, 13 Oct 2020 15:12:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EE0446100A; Tue, 13 Oct 2020 17:12:55 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="uAS/TJiY"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 87EDC60E86 for ; Tue, 13 Oct 2020 17:12:49 +0200 (CEST) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 21E17192C; Tue, 13 Oct 2020 17:12:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602601969; bh=xsOYFh06ERxj69NBq90KyxIuHU/o74gNLK564ZJBcJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uAS/TJiYEsbYm8Ku1LbS3VEA/Yl7/KL7IaPgvh+72vRH1vKX27q0WhKHxT0YlzbWu aQxxukx6vKRiELfj8ZAlgm9Pn4+V5GpjnT1yG5fVVZpN2xMYu9s8aECtrDSTnIOBOB RmNLctsSdROUkZbGT6Vz6bp0qaqwkwTueg95/TXQ= From: Kieran Bingham To: libcamera devel Date: Tue, 13 Oct 2020 16:12:40 +0100 Message-Id: <20201013151241.3557005-10-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> References: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 09/10] android: metadata: Prevent variable aliasing X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The validate_camera_metadata_structure() call uses two instances of a variable named aligned_ptr(). Reuse the first instance which is not otherwise re-used for the second scoped usage. Signed-off-by: Kieran Bingham Reviewed-by: Niklas Söderlund --- *** This is in android metadata library code *** This is only here as a temporary repair. Ideally we shouldn't make changes to this code base. disabling the warning on this library component is likely a better choice. src/android/metadata/camera_metadata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/metadata/camera_metadata.c b/src/android/metadata/camera_metadata.c index b86586a7e685..129d1e92ece1 100644 --- a/src/android/metadata/camera_metadata.c +++ b/src/android/metadata/camera_metadata.c @@ -433,7 +433,7 @@ int validate_camera_metadata_structure(const camera_metadata_t *metadata, }; for (size_t i = 0; i < sizeof(alignments)/sizeof(alignments[0]); ++i) { - uintptr_t aligned_ptr = ALIGN_TO((uintptr_t) metadata + alignmentOffset, + aligned_ptr = ALIGN_TO((uintptr_t) metadata + alignmentOffset, alignments[i].alignment); if ((uintptr_t)metadata + alignmentOffset != aligned_ptr) {