[{"id":11784,"web_url":"https://patchwork.libcamera.org/comment/11784/","msgid":"<20200802233110.GK23801@pendragon.ideasonboard.com>","date":"2020-08-02T23:31:10","subject":"Re: [libcamera-devel] [PATCH] libcamera: device_enumerator_udev:\n\tInitialize monitor_ and notifier_ to nullptr","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Niklas,\n\nThank you for the patch.\n\nOn Mon, Aug 03, 2020 at 01:16:52AM +0200, Niklas Söderlund wrote:\n> The monitor_ and notifier_ pointers are acted on in the destructor if\n> not set to nullptr, the pointers are however first initialized in\n> enumerate(). If the object is deleted without enumerate() being called\n> the destructor acts on uninitialized pointers, fix this by initializing\n> them to nullptr.\n\nNote that monitor_ is created in init(), not enumerate(). The issue is\nstill the same though, only the commit message should be updated.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n> ---\n>  src/libcamera/device_enumerator_udev.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/device_enumerator_udev.cpp b/src/libcamera/device_enumerator_udev.cpp\n> index 56ca4dc2804b46b9..96689daa5dd113dc 100644\n> --- a/src/libcamera/device_enumerator_udev.cpp\n> +++ b/src/libcamera/device_enumerator_udev.cpp\n> @@ -27,7 +27,7 @@ namespace libcamera {\n>  LOG_DECLARE_CATEGORY(DeviceEnumerator)\n>  \n>  DeviceEnumeratorUdev::DeviceEnumeratorUdev()\n> -\t: udev_(nullptr)\n> +\t: udev_(nullptr), monitor_(nullptr), notifier_(nullptr)\n>  {\n>  }\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 8278CBD87A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSun,  2 Aug 2020 23:31:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1F910603F7;\n\tMon,  3 Aug 2020 01:31:23 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B217860398\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Aug 2020 01:31:21 +0200 (CEST)","from pendragon.ideasonboard.com (81-175-216-236.bb.dnainternet.fi\n\t[81.175.216.236])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 25FC0296;\n\tMon,  3 Aug 2020 01:31:21 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"YOUWx1De\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1596411081;\n\tbh=oYmE22ZwDKBDQCofE2OKqsBSiIBMqWRkLMP13X119ow=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=YOUWx1DevzCYsUsiSLyUFmKtfgMUcjodUkzDLWtD9A192VtsRmF7l9T00k9jGtA3t\n\twjpoPHDQwVc4fd6FZgnYtXHaSQ4OhJFiUgcPBEkL1oZTfBQEwN+Yu/Q8yZl+FfIG6l\n\tXvi5E1Y31q06MQxHaTri4uWIbSBXQHDIXlLApJIM=","Date":"Mon, 3 Aug 2020 02:31:10 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Niklas =?utf-8?q?S=C3=B6derlund?= <niklas.soderlund@ragnatech.se>","Message-ID":"<20200802233110.GK23801@pendragon.ideasonboard.com>","References":"<20200802231652.360645-1-niklas.soderlund@ragnatech.se>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20200802231652.360645-1-niklas.soderlund@ragnatech.se>","Subject":"Re: [libcamera-devel] [PATCH] libcamera: device_enumerator_udev:\n\tInitialize monitor_ and notifier_ to nullptr","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=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":11786,"web_url":"https://patchwork.libcamera.org/comment/11786/","msgid":"<a8d2b407-4faf-9d1f-836d-aced21869cbf@uajain.com>","date":"2020-08-03T05:38:30","subject":"Re: [libcamera-devel] [PATCH] libcamera: device_enumerator_udev:\n\tInitialize monitor_ and notifier_ to nullptr","submitter":{"id":1,"url":"https://patchwork.libcamera.org/api/people/1/","name":"Umang Jain","email":"email@uajain.com"},"content":"Hi Niklas, Laurent,\n\nOn 8/3/20 5:01 AM, Laurent Pinchart wrote:\n> Hi Niklas,\n>\n> Thank you for the patch.\n>\n> On Mon, Aug 03, 2020 at 01:16:52AM +0200, Niklas Söderlund wrote:\n>> The monitor_ and notifier_ pointers are acted on in the destructor if\n>> not set to nullptr, the pointers are however first initialized in\n>> enumerate(). If the object is deleted without enumerate() being called\n>> the destructor acts on uninitialized pointers, fix this by initializing\n>> them to nullptr.\n> Note that monitor_ is created in init(), not enumerate(). The issue is\n> still the same though, only the commit message should be updated.\n>\n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nDitto. The commit message is the only change needed.\nReviewed-by: Umang Jain <email@uajain.com>\n>\n>> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\n>> ---\n>>   src/libcamera/device_enumerator_udev.cpp | 2 +-\n>>   1 file changed, 1 insertion(+), 1 deletion(-)\n>>\n>> diff --git a/src/libcamera/device_enumerator_udev.cpp b/src/libcamera/device_enumerator_udev.cpp\n>> index 56ca4dc2804b46b9..96689daa5dd113dc 100644\n>> --- a/src/libcamera/device_enumerator_udev.cpp\n>> +++ b/src/libcamera/device_enumerator_udev.cpp\n>> @@ -27,7 +27,7 @@ namespace libcamera {\n>>   LOG_DECLARE_CATEGORY(DeviceEnumerator)\n>>   \n>>   DeviceEnumeratorUdev::DeviceEnumeratorUdev()\n>> -\t: udev_(nullptr)\n>> +\t: udev_(nullptr), monitor_(nullptr), notifier_(nullptr)\n>>   {\n>>   }\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 40034BD87A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  3 Aug 2020 05:38:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C427C609B9;\n\tMon,  3 Aug 2020 07:38:34 +0200 (CEST)","from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 9E22260390\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  3 Aug 2020 07:38:32 +0200 (CEST)","by filterdrecv-p3iad2-d8cc6d457-jqj7p with SMTP id\n\tfilterdrecv-p3iad2-d8cc6d457-jqj7p-18-5F27A2D6-2\n\t2020-08-03 05:38:30.258645085 +0000 UTC m=+387012.089780665","from mail.uajain.com (unknown)\n\tby ismtpd0001p1maa1.sendgrid.net (SG) with ESMTP\n\tid BQnKE8cNQD29qt_OHLMBQw Mon, 03 Aug 2020 05:38:29.561 +0000 (UTC)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=uajain.com header.i=@uajain.com\n\theader.b=\"bCJDVZlt\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com;\n\th=subject:references:from:mime-version:in-reply-to:to:cc:content-type;\n\ts=s1; bh=WGZI2fIZ/5nGbvNl9TlytwYX2jTTB80KpMRnSMtvk3w=;\n\tb=bCJDVZltRoG7K8BbejhaqMblPBkAbs1d1LU6TjhD0D8IGFmvepAiZayl13y2w5rYa+mP\n\tkQxFXBSZmOrzXFSrAkI1+k8EqD+NIo4lpOt5bNpX9/uVXPkFmNbCHDO8cEz6c63sqoyTat\n\t37K279Pc9UpV70G3ztKRwirUPJhNsEuJM=","References":"<20200802231652.360645-1-niklas.soderlund@ragnatech.se>\n\t<20200802233110.GK23801@pendragon.ideasonboard.com>","From":"Umang Jain <email@uajain.com>","Message-ID":"<a8d2b407-4faf-9d1f-836d-aced21869cbf@uajain.com>","Date":"Mon, 03 Aug 2020 05:38:30 +0000 (UTC)","Mime-Version":"1.0","In-Reply-To":"<20200802233110.GK23801@pendragon.ideasonboard.com>","X-SG-EID":"1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcofpXQ1KwJPJayd5tGsU1eJXGbBwvyhUEpq7VsI38GLXVQAGAK88ArA96MI8CabHt+peSTUbeAlEDSjqDo6w+y/4ZHgD9VOj/iT+u5AQyDqnSzo4m5qOynGRWEHfPrDik79bKh7qbNyPGT1i+Whsdnepe+qFlyz59TgzZQE5LfAhR+XU51TBAZ9Ois6WgXoAVPvA6wz28/ivJiGYyOMPp7g==","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Niklas\n\t=?iso-8859-1?q?S=F6derlund?= <niklas.soderlund@ragnatech.se>","Content-Language":"en-US","Subject":"Re: [libcamera-devel] [PATCH] libcamera: device_enumerator_udev:\n\tInitialize monitor_ and notifier_ to nullptr","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":"multipart/mixed;\n\tboundary=\"===============7996524017816593408==\"","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]