From mboxrd@z Thu Jan 1 00:00:00 1970 From: Russell King - ARM Linux Subject: Re: [PATCH 2/2] iommu/omap: fix NULL pointer dereference Date: Wed, 22 Feb 2012 08:56:23 +0000 Message-ID: <20120222085623.GF22675@n2100.arm.linux.org.uk> References: <1329900772-9306-1-git-send-email-ohad@wizery.com> <1329900772-9306-2-git-send-email-ohad@wizery.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1329900772-9306-2-git-send-email-ohad-Ix1uc/W3ht7QT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Ohad Ben-Cohen Cc: Tony Lindgren , Hiroshi DOYU , iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, Laurent Pinchart , linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org List-Id: linux-omap@vger.kernel.org On Wed, Feb 22, 2012 at 10:52:52AM +0200, Ohad Ben-Cohen wrote: > @@ -274,7 +274,7 @@ static ssize_t debug_read_mem(struct file *file, char __user *userbuf, > mutex_lock(&iommu_debug_lock); > > area = omap_find_iovm_area(dev, (u32)ppos); > - if (IS_ERR(area)) { > + if (IS_ERR_OR_NULL(area)) { > bytes = -EINVAL; There's something else which needs fixing here - the return code. If omap_find_iovm_area() returns an error code that needs propagating. Otherwise it might as well just return NULL for all errors.