[{"id":13077,"web_url":"https://patchwork.libcamera.org/comment/13077/","msgid":"<CAHW6GY+HnCifTDtRtBe2-TeT1jOHciU8gOTrmw2xZdbu3fFREw@mail.gmail.com>","date":"2020-10-07T13:48:37","subject":"Re: [libcamera-devel] [PATCH v2 3/3] ipa: raspberrypi: fix missing\n\tinitialize of status_","submitter":{"id":42,"url":"https://patchwork.libcamera.org/api/people/42/","name":"David Plowman","email":"david.plowman@raspberrypi.com"},"content":"Hi Tomi\n\nThanks for this patch. Actually I'm OK for this to go in subject to a\ncouple of very minor nitpicks... (sorry!)\n\nOn Wed, 7 Oct 2020 at 14:18, Tomi Valkeinen <tomi.valkeinen@iki.fi> wrote:\n>\n> Many fields in status_ are not initialized, causing use of uninitialized\n> memory.\n>\n> Drop the code that clears some of the individual fields, and instead\n> just memset the whole thing.\n>\n> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>\n> ---\n>  src/ipa/raspberrypi/controller/rpi/agc.cpp | 16 ++++++++--------\n>  1 file changed, 8 insertions(+), 8 deletions(-)\n>\n> diff --git a/src/ipa/raspberrypi/controller/rpi/agc.cpp b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> index df4d364..6ae774d 100644\n> --- a/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> +++ b/src/ipa/raspberrypi/controller/rpi/agc.cpp\n> @@ -148,14 +148,14 @@ Agc::Agc(Controller *controller)\n>           exposure_mode_(nullptr), constraint_mode_(nullptr),\n>           frame_count_(0), lock_count_(0)\n>  {\n> -       ev_ = status_.ev = 1.0;\n> -       flicker_period_ = status_.flicker_period = 0.0;\n> -       fixed_shutter_ = status_.fixed_shutter = 0;\n> -       fixed_analogue_gain_ = status_.fixed_analogue_gain = 0.0;\n> -       // set to zero initially, so we can tell it's not been calculated\n\nWe could keep the comment here, perhaps. Maybe\n\n// set status_.total_exposure_value to zero initially, so we can tell\nit's not been calculated\n\n> -       status_.total_exposure_value = 0.0;\n> -       status_.target_exposure_value = 0.0;\n> -       status_.locked = false;\n> +       memset(&status_, 0, sizeof(status_));\n> +       status_.ev = 1.0;\n> +\n> +       ev_ = status_.ev;\n> +       flicker_period_ = status_.flicker_period;\n> +       fixed_shutter_ = status_.fixed_shutter;\n> +       fixed_analogue_gain_ = status_.fixed_analogue_gain;\n\nI'd prefer to set the values explicitly here, i.e. 1.0 or 0.0 rather\nthan to copy them. I know it makes no difference, but the intent is\nthat, for example, \"fixed_shutter_\" should be zero, not \"whatever\nstatus_.fixed-shutter is\". I know I'm splitting hairs, for which I\napologise. But I don't feel that strongly whether we change this or\nnot, so\n\nReviewed-by: David Plowman <david.plowman@raspberrypi.com>\n\nThanks very much for the fixes!\n\nBest regards\nDavid\n\n> +\n>         output_status_ = status_;\n>  }\n>\n> --\n> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.\n> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id B139DBEEE0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  7 Oct 2020 13:48:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7D8D960719;\n\tWed,  7 Oct 2020 15:48:51 +0200 (CEST)","from mail-ot1-x344.google.com (mail-ot1-x344.google.com\n\t[IPv6:2607:f8b0:4864:20::344])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 06C4E6039B\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 Oct 2020 15:48:51 +0200 (CEST)","by mail-ot1-x344.google.com with SMTP id i12so2254296ota.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 07 Oct 2020 06:48:50 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"Fr3pLT9t\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=tDTLZtCJJ+rWVu5gPCaWPyqQmh59AQSr8xlMaMn3Pqs=;\n\tb=Fr3pLT9tv4SoWY96XpVyVNNOJmTfQyPzXeyK5HMe+Uwz7Hq3FbAb+3VYZJR9Hq2fBY\n\tVWI7ttTasD+stZ3q3Zs0stiJ4BWfKgiqWdZTJJRUGTNX81fE1TFUoa8kZjmwKuk7TfFz\n\txsKNBmlOI013HqbjKcSED82/nMTALFxdR9tqxQrkibqWLrbIaI9GJ6WbE82+kFUmFAfA\n\t6CHEdwNNVgbpG8L1f+2d4V7FJJz/PM4lQLIo3+A5C/HhFOtzxUAMHqhD7kys/sKFWaSY\n\tvmqZzj88R9qX2Dc95BPc7ut4BoGSBYalvHmnDEQyojwVbVpXVGxjwKREiZw3a2craN9S\n\tX4sQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=tDTLZtCJJ+rWVu5gPCaWPyqQmh59AQSr8xlMaMn3Pqs=;\n\tb=naXgnB3KnmMVjkR5UIJDmAotXfhSs6W9ewb40K56Kgm/iup2pQV+G53LXjBFp5VIfT\n\tIkhGENtuWRIAcNvH7AEglzs6QM3pi41yBsv0LC3MZNKplWclgd4+DHOIsFrxwWRfS7e3\n\t/B5FExSq2JAYZK3hyS2p4vXmfXEW7xZNGGnIqXOIQQ0up/OlIr6lgh7XGJowj8HI04tP\n\tm3wZ3/46SY8XS2tgeVocV04rvFk7YjjPx2/sXohf/nD0H81bLrkMBMKTuu/+7j9zd5W0\n\tVl6Awb7KJFo1AouNrAmRSmCydUtBwPPZTE1RxMHmt38t2mPfCFH70RLsNVKQDjZAQ1PR\n\tkx+w==","X-Gm-Message-State":"AOAM532Xo7KAjSBeKFvPCEIXPxyha5gTYiDdUfqGQojP5V3rI+p/4r6n\n\ttumTQCQ3D7/cBm1AIOi8wHCw8v3EI4e+Pid5nIpCgg==","X-Google-Smtp-Source":"ABdhPJx3agH4ZJLfU3Cm6N5yDipqkX8SvXD5sgcvSCUBZwaWyUU5amljpecMQj3lIJdVkRJELpE0Y/Hj4EJvFxRQ34o=","X-Received":"by 2002:a9d:68c2:: with SMTP id i2mr1922042oto.166.1602078529626;\n\tWed, 07 Oct 2020 06:48:49 -0700 (PDT)","MIME-Version":"1.0","References":"<20201007131812.2688973-1-tomi.valkeinen@iki.fi>\n\t<20201007131812.2688973-4-tomi.valkeinen@iki.fi>","In-Reply-To":"<20201007131812.2688973-4-tomi.valkeinen@iki.fi>","From":"David Plowman <david.plowman@raspberrypi.com>","Date":"Wed, 7 Oct 2020 14:48:37 +0100","Message-ID":"<CAHW6GY+HnCifTDtRtBe2-TeT1jOHciU8gOTrmw2xZdbu3fFREw@mail.gmail.com>","To":"Tomi Valkeinen <tomi.valkeinen@iki.fi>","Subject":"Re: [libcamera-devel] [PATCH v2 3/3] ipa: raspberrypi: fix missing\n\tinitialize of status_","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":13080,"web_url":"https://patchwork.libcamera.org/comment/13080/","msgid":"<41adc760-1c73-b0ef-c361-ad4ae6037dca@iki.fi>","date":"2020-10-07T14:22:57","subject":"Re: [libcamera-devel] [PATCH v2 3/3] ipa: raspberrypi: fix missing\n\tinitialize of status_","submitter":{"id":70,"url":"https://patchwork.libcamera.org/api/people/70/","name":"Tomi Valkeinen","email":"tomi.valkeinen@iki.fi"},"content":"Hi David,\n\nOn 07/10/2020 16:48, David Plowman wrote:\n> Hi Tomi\n> \n> Thanks for this patch. Actually I'm OK for this to go in subject to a\n> couple of very minor nitpicks... (sorry!)\n\nWell, you could consider these patches more like bug reports than real patches, as I have no idea\nwhat the code is doing =).\n\nIf you're already working on agc.cpp, I'm fine with you fixing this in your series however you see best.\n\nI just wanted to get rid of all the valgrind warnings so that I could see if my code causes any.\n\n Tomi","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id B01CEBEEDF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  7 Oct 2020 14:23:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 47689605C3;\n\tWed,  7 Oct 2020 16:23:00 +0200 (CEST)","from mail-lj1-x244.google.com (mail-lj1-x244.google.com\n\t[IPv6:2a00:1450:4864:20::244])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 29FE4605BE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  7 Oct 2020 16:22:59 +0200 (CEST)","by mail-lj1-x244.google.com with SMTP id h20so2155094lji.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 07 Oct 2020 07:22:59 -0700 (PDT)","from [192.168.1.111] (91-152-83-50.elisa-laajakaista.fi.\n\t[91.152.83.50]) by smtp.gmail.com with ESMTPSA id\n\tf26sm378443ljo.96.2020.10.07.07.22.57\n\t(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n\tWed, 07 Oct 2020 07:22:57 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"lVyccUVq\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:subject:to:cc:references:from:message-id:date:user-agent\n\t:mime-version:in-reply-to:content-language:content-transfer-encoding; \n\tbh=EkrBeht9cS1kDu72O1m5+d+mAoRH2o/rMBLJCzuB8W4=;\n\tb=lVyccUVqUQnuJ1wlosgTzvtzBJ6Jwq3LoehN4JJSBu1S9ylk6h9ZMK/0XRxdExTLZ8\n\tjtPHHBEC2fNPi/irwNqe0dJhzr308/Csb5t53rj6V3NDaRdXQkBZj2T/67i0p3PYE15n\n\tz/cYkR6UtBQHT6NdkAEVi0IEv4p9b5STvIYIBIvtDjBmNDxS3efU4JsgtPjBeKzAlhX/\n\tfcY5ZiBLFGOXt1CMmeXp3awG8C1RR6n85V+9H04elr8JSX2Btud9Sd6wCaZnP6Wz0YAg\n\tYaOa5lqnJki6PnvrZvgsdbQhFrGOgUWoc2iONM0ANssdpapx+8GDHs9CY5C39MzDg6Vd\n\tMwRg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:subject:to:cc:references:from:message-id\n\t:date:user-agent:mime-version:in-reply-to:content-language\n\t:content-transfer-encoding;\n\tbh=EkrBeht9cS1kDu72O1m5+d+mAoRH2o/rMBLJCzuB8W4=;\n\tb=nSnaH5xGwzRcIT5nVl3MIzEJ4nk6dX56Z9CGcGRfcSMhI6HCSAzays3hXfIqVF7M2j\n\t2Ymsw2jXlZWOFev1+aRqIYJMo3IeCcF/IePCrk+4yQuHqodOac2w6SKngfVfndj6ORJw\n\tpStErC3mr53rqQv0EG7xYqiS21pcrNQaxxZJYA38JngyH6UabLAhV81hd1L5KKeelOeb\n\tf8Qq79l9DGuXuCFXKyqWGpxg4QNaYG3BBtKF3O8r2pPfHiA4oyGhHeCfAoJPi5A1szmI\n\tQ6zx5yGceVpG/aH0wyrD52gCWt0pVT88yhopksu0JoYPEx9g5eRT2q/MF2Bs1yWabUMJ\n\t1uQA==","X-Gm-Message-State":"AOAM532zxN84TUyU0CECFVlgGzLFeyqQSChkhbKXQzoIQdCD8F65HeUg\n\tfcBckrjq/yxOYNFqdE44FM1MB11z/TrQqQ==","X-Google-Smtp-Source":"ABdhPJzq+aiWSORDspYFYQL3aZRsbJWgv9/8Xs5UsI31NUB+xdeqTKBYrQ6Z18UtHlhrggarIiBqJg==","X-Received":"by 2002:a05:651c:1205:: with SMTP id\n\ti5mr1336621lja.47.1602080578233; \n\tWed, 07 Oct 2020 07:22:58 -0700 (PDT)","To":"David Plowman <david.plowman@raspberrypi.com>","References":"<20201007131812.2688973-1-tomi.valkeinen@iki.fi>\n\t<20201007131812.2688973-4-tomi.valkeinen@iki.fi>\n\t<CAHW6GY+HnCifTDtRtBe2-TeT1jOHciU8gOTrmw2xZdbu3fFREw@mail.gmail.com>","From":"Tomi Valkeinen <tomi.valkeinen@iki.fi>","Message-ID":"<41adc760-1c73-b0ef-c361-ad4ae6037dca@iki.fi>","Date":"Wed, 7 Oct 2020 17:22:57 +0300","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101\n\tThunderbird/68.10.0","MIME-Version":"1.0","In-Reply-To":"<CAHW6GY+HnCifTDtRtBe2-TeT1jOHciU8gOTrmw2xZdbu3fFREw@mail.gmail.com>","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [PATCH v2 3/3] ipa: raspberrypi: fix missing\n\tinitialize of status_","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]