Received: by 10.192.165.148 with SMTP id m20csp4231296imm; Tue, 8 May 2018 05:18:57 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpg7u/rHhV/ZobecAfiNwOh6tfYYRxOitPVGSxGNgPbZR2BViWv7LTFI+ao9RwuJCpok5eG X-Received: by 2002:a17:902:a4:: with SMTP id a33-v6mr17455477pla.346.1525781936978; Tue, 08 May 2018 05:18:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525781936; cv=none; d=google.com; s=arc-20160816; b=esjI60gJ8GsXZ7A2yNmCunz2SZdwur6B8YhOthTW2QpsJP4SBROTk4RMhKQDccuZjO B1wGYvXYSPzpAPu3GMQIhm47OAuRWYoAmYWIdd2oNdrFKlhFuwVSY0mKz8pTSORKUnuy tOENyze62eWc10Okw/2KsWI821umN3z5JwXDeU95LoZ2AG45c8BfQ3XvZZNJ9XvKflh9 PaJ3PkNGnSZPBYgrBQ9+B3eYmQ/CwYwmzIYmydDbLG4Q/3597PVMEPg79+Sn2wVUSuIb jcz+vWYdNDckq5T/uYuG7AJvgJFYGlB7eLZxdKMxTwFozTc/AumGRURhMAg3YEM4393n +Z4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=a9CBzZweJIv9/MnoV/TC7bIvSjBMTPcFjvo4yjAO3LM=; b=GSEBpqatSfIs0/bzGYmtw4VZiELPV56L/hRiswMTqRTtWG8i4ZG2vFc/XoNrG6evrO D7kTLn7uWwkE+ezDASTqO/VxPIovNUTmDA1KahMnyV2ESpkLQZ89S8gaRxIsimOgHJVR 3exvJIOcgPw1kZcfhuI9vx47IeVyJe7hoyapxiBEHBfJOetREcKR2UNf3GzzFkpjJ229 4waK72dN7Ru68SdfhC7mkAnVfZHQhAOzjnxOyBf+Q1yi1HQWOQmEyIgvN1oYCEU7S9ou 66cXh3TzR0y7GV6dnkJ8ebjPCQgYGwF2KUpjDwiZboJArpFidZgwQ/fsc5Rl4XxfomM4 sJQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=tU38J55m; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y15-v6si19039475pgv.69.2018.05.08.05.18.42; Tue, 08 May 2018 05:18:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=tU38J55m; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754999AbeEHMQ4 (ORCPT + 99 others); Tue, 8 May 2018 08:16:56 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:53248 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754979AbeEHMQx (ORCPT ); Tue, 8 May 2018 08:16:53 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w48C6YHH173481; Tue, 8 May 2018 12:16:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2017-10-26; bh=a9CBzZweJIv9/MnoV/TC7bIvSjBMTPcFjvo4yjAO3LM=; b=tU38J55mLmmXcxgcXerRT/qrfbv0Cc750DrDye0fFn8H8Y5HWhmnQb0yyvQwfLZxtsJd nuLh6WW2vn2hhoAj9ehTYoEBVHpitqyRDKZtj+PUbY75cdepRtqVpa7PyAezK3RyJnWO wxswRzkkFiZSeXHlI9LwuvN1p5ECc/QiCXKTitgFLA3eyN/qEiKHZNCzgkQ1hhW3tDNn jAY0QcLy3hguMyg9ebHKj8cckWM8/F9d25P+i2rgTmKVH94VB8mXPL80IhuJcSO+QEqY KuZJDqWKwK9aZyi8EuBS0QCocRi+Ng/17XQo4sRGMeP3WKxtVK7C0GepM+Sy4sklvurH rA== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2hs426gb3t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 08 May 2018 12:16:45 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w48CGi28019571 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 8 May 2018 12:16:44 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w48CGhbe030467; Tue, 8 May 2018 12:16:43 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 08 May 2018 05:16:43 -0700 Date: Tue, 8 May 2018 15:16:35 +0300 From: Dan Carpenter To: Wenwen Wang Cc: "open list:STAGING SUBSYSTEM" , Andy Shevchenko , Greg Kroah-Hartman , Kangjie Lu , "open list:STAGING - ATOMISP DRIVER" , open list , Hans Verkuil , Sakari Ailus , Mauro Carvalho Chehab , Alan Cox Subject: Re: [PATCH] media: staging: atomisp: fix a potential missing-check bug Message-ID: <20180508121635.mdw4jikv66iyprie@mwanda> References: <1525300731-27324-1-git-send-email-wang6495@umn.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1525300731-27324-1-git-send-email-wang6495@umn.edu> User-Agent: NeoMutt/20170609 (1.8.3) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8886 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=867 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805080118 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 02, 2018 at 05:38:49PM -0500, Wenwen Wang wrote: > At the end of atomisp_subdev_set_selection(), the function > atomisp_subdev_get_rect() is invoked to get the pointer to v4l2_rect. Since > this function may return a NULL pointer, it is firstly invoked to check > the returned pointer. If the returned pointer is not NULL, then the > function is invoked again to obtain the pointer and the memory content > at the location of the returned pointer is copied to the memory location of > r. In most cases, the pointers returned by the two invocations are same. > However, given that the pointer returned by the function > atomisp_subdev_get_rect() is not a constant, it is possible that the two > invocations return two different pointers. For example, another thread may > race to modify the related pointers during the two invocations. You're assuming a very serious race condition exists. > In that > case, even if the first returned pointer is not null, the second returned > pointer might be null, which will cause issues such as null pointer > dereference. And then complaining that if a really serious bug exists then this very minor bug would exist too... If there were really a race condition like that then we'd want to fix it instead. In other words, this is not a real life bug fix. But it would be fine as a readability or static checker fix so that's fine. regards, dan carpenter