Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759107AbcDAOi2 (ORCPT ); Fri, 1 Apr 2016 10:38:28 -0400 Received: from mail-io0-f177.google.com ([209.85.223.177]:34188 "EHLO mail-io0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758909AbcDAOi0 (ORCPT ); Fri, 1 Apr 2016 10:38:26 -0400 Subject: Re: [PATCH v2] block: fix possible NULL dereference To: Sudip Mukherjee References: <1459521258-18534-1-git-send-email-sudipm.mukherjee@gmail.com> Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Johannes Thumshirn From: Jens Axboe Message-ID: <56FE87DF.3000603@kernel.dk> Date: Fri, 1 Apr 2016 08:38:23 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <1459521258-18534-1-git-send-email-sudipm.mukherjee@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 739 Lines: 20 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. -- Jens Axboe