From patchwork Wed Oct 7 13:18:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 10015 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 D311BBEEE0 for ; Wed, 7 Oct 2020 13:18:31 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A2435605BD; Wed, 7 Oct 2020 15:18:31 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="nUHT/lL9"; dkim-atps=neutral Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A29FA605C1 for ; Wed, 7 Oct 2020 15:18:29 +0200 (CEST) Received: by mail-lj1-x22a.google.com with SMTP id a5so1920430ljj.11 for ; Wed, 07 Oct 2020 06:18:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Op4MknI1SgUbicnV8hX1MgQiNFJB/6qJmdYNwp8arEk=; b=nUHT/lL9EOjKiQj2Pw35xBx4/FTkHCWj8/1w9pUSWMYyMwSP0FN0yIceKGCpisnE86 sZ3ptdrMidG3DQJsKrt5VTMwI8Xr5T8+LrP09PXnSqhyrb/UUZLqTGlAyOZ59h3Pjq+G THpHxk0XmKasO57W0dU9M0obLCLP3rwswnpVpJzgsJ7oY6hSq5BFAjHr0MT6tk/rcy3w 5ucDwu0UzWmCOuP4T/1a/HxYIlt7WdHhbA+MuGtwyq2+IkAKsvn9ulKpolBMnoKQfXum lwtqDxJ+BeXKbADMhW/3i4fvqLkR6JMe6SFpqx5q2mLBR+4IOUEsDSJ9rkF5mm3WBqYR Q51w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Op4MknI1SgUbicnV8hX1MgQiNFJB/6qJmdYNwp8arEk=; b=U4Vp5Ojfn5zx1sZP7ZJ8zllzh/s8DuY1QZpm5ndRy3sHJgLXkQqgfwgB5ckKNi3gUC Ute030RCTE9b6sVXf2uR+ZFe3ZbPqSvmy/arDm/gtxnpiSIihj3uhvj6cfUq9Q2zZCA6 RIQ0eRVclxVrP0fYbpVpChQVPaGUvwmU0zmv2RkMBWedkihtt/gI56nLF4oqmOZcI5a4 cX0QQEkeTbILMLvd7AFbKZlqZSpYYw+sH3LV1eLAC130CQQQc7KtuYRDa3/erG9yrgzk QpMtKSDQzeCV89QhW2inMVgK2KHhJwpqUGRKxqaOr9TSyk5mp9mubN5ltdZB/3GyrVGZ fzvQ== X-Gm-Message-State: AOAM532MaKBWQxDeuNhx486z+Zo/GJooTVBVyGcZeuqenG0Iis0nvWz7 B7a2vPJs/nqeeD69bh2+HDQglcCjpQXk0g== X-Google-Smtp-Source: ABdhPJz7Y/HYo8t1xscqcHgMCnrlzMHuD88ifhRxnwR3ijIFTM6nhIlHtnQmqc44bEi5T4jO1JuzUg== X-Received: by 2002:a05:651c:141:: with SMTP id c1mr1279566ljd.182.1602076708947; Wed, 07 Oct 2020 06:18:28 -0700 (PDT) Received: from deskari.lan (91-152-83-50.elisa-laajakaista.fi. [91.152.83.50]) by smtp.gmail.com with ESMTPSA id i139sm329539lfi.276.2020.10.07.06.18.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Oct 2020 06:18:28 -0700 (PDT) From: Tomi Valkeinen To: libcamera-devel@lists.libcamera.org, Naushir Patuck , David Plowman Date: Wed, 7 Oct 2020 16:18:12 +0300 Message-Id: <20201007131812.2688973-4-tomi.valkeinen@iki.fi> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201007131812.2688973-1-tomi.valkeinen@iki.fi> References: <20201007131812.2688973-1-tomi.valkeinen@iki.fi> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 3/3] ipa: raspberrypi: fix missing initialize of status_ 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: , Cc: Tomi Valkeinen Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Many fields in status_ are not initialized, causing use of uninitialized memory. Drop the code that clears some of the individual fields, and instead just memset the whole thing. Signed-off-by: Tomi Valkeinen Reviewed-by: David Plowman --- src/ipa/raspberrypi/controller/rpi/agc.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp index df4d364..6ae774d 100644 --- a/src/ipa/raspberrypi/controller/rpi/agc.cpp +++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp @@ -148,14 +148,14 @@ Agc::Agc(Controller *controller) exposure_mode_(nullptr), constraint_mode_(nullptr), frame_count_(0), lock_count_(0) { - ev_ = status_.ev = 1.0; - flicker_period_ = status_.flicker_period = 0.0; - fixed_shutter_ = status_.fixed_shutter = 0; - fixed_analogue_gain_ = status_.fixed_analogue_gain = 0.0; - // set to zero initially, so we can tell it's not been calculated - status_.total_exposure_value = 0.0; - status_.target_exposure_value = 0.0; - status_.locked = false; + memset(&status_, 0, sizeof(status_)); + status_.ev = 1.0; + + ev_ = status_.ev; + flicker_period_ = status_.flicker_period; + fixed_shutter_ = status_.fixed_shutter; + fixed_analogue_gain_ = status_.fixed_analogue_gain; + output_status_ = status_; }