From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751899AbbGLGOt (ORCPT ); Sun, 12 Jul 2015 02:14:49 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:35207 "EHLO mail-pd0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751210AbbGLGOs (ORCPT ); Sun, 12 Jul 2015 02:14:48 -0400 Date: Sun, 12 Jul 2015 11:44:38 +0530 From: Sudip Mukherjee To: Rob Clark Cc: David Airlie , Linux Kernel Mailing List , "dri-devel@lists.freedesktop.org" Subject: Re: [PATCH] drm/atomic: fix null dereference Message-ID: <20150712061438.GA2649@sudip-PC> References: <1436635479-1460-1-git-send-email-sudipm.mukherjee@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 11, 2015 at 02:17:49PM -0400, Rob Clark wrote: > On Sat, Jul 11, 2015 at 1:24 PM, Sudip Mukherjee > wrote: > > We are checking the size of e->event but we were doing it when e is > > known to be NULL. > > nak, this will leak event_space.. since it is a sizeof, it isn't > actually deref'ing e, but rather just using the static type info, so > it's ok (although perhaps funny looking) Agreed, and I just verified the same with an userspace code also. But i think this will confuse people like me who have started to look at the drm code to start working with some new drm driver. what about: file_priv->event_space += sizeof(struct drm_event_vblank); It will server the same purpose yet it will not be confusing. regards sudip