Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932506AbcDAPSk (ORCPT ); Fri, 1 Apr 2016 11:18:40 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:35549 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932388AbcDAPSi (ORCPT ); Fri, 1 Apr 2016 11:18:38 -0400 Date: Fri, 1 Apr 2016 16:18:28 +0100 From: Sudip Mukherjee To: Jens Axboe Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Johannes Thumshirn Subject: Re: [PATCH v2] block: fix possible NULL dereference Message-ID: <20160401151828.GA20149@sudip-tp> References: <1459521258-18534-1-git-send-email-sudipm.mukherjee@gmail.com> <56FE87DF.3000603@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56FE87DF.3000603@kernel.dk> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 928 Lines: 24 On Fri, Apr 01, 2016 at 08:38:23AM -0600, Jens Axboe wrote: > On 04/01/2016 08:34 AM, Sudip Mukherjee wrote: > >We were checking for iter to be NULL after dereferencing it. There is > >actually no need to check for iter to be NULL as all the callers of > >blk_rq_map_user_iov() does call it with a valid pointer to > >struct iov_iter. > >But as iter->count can be NULL so the assignment to copy is being done > >after checking for it. > > > >Signed-off-by: Sudip Mukherjee > >--- > > > >v2: removed the check for iter > >v1: moved the assignment to copy after check for iter and iter->count > > Your subject is wrong (there's no NULL deref). Ditto for the commit message > - it can be zero, not NULL. The latter would imply a memory address, but > it's just an integer. oops. I should have checked. I wanted to keep the commit message similar to v1. I will send a v3 for this. regards sudip