From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755535AbdJIWeD (ORCPT ); Mon, 9 Oct 2017 18:34:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:50656 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754404AbdJIWeB (ORCPT ); Mon, 9 Oct 2017 18:34:01 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 227B7218BB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=rostedt@goodmis.org Date: Mon, 9 Oct 2017 18:33:59 -0400 From: Steven Rostedt To: Michael Sartain Cc: linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/5] trace-cmd: Fix NULL pointer being passed to memcpy Message-ID: <20171009183359.3267a870@gandalf.local.home> In-Reply-To: <20171009222710.zl5awmvxe6mxzqgk@mikesart-cos> References: <20170812173047.840-1-mikesart@fastmail.com> <20170812173047.840-3-mikesart@fastmail.com> <20171009182432.7c2e0d04@gandalf.local.home> <20171009222710.zl5awmvxe6mxzqgk@mikesart-cos> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 9 Oct 2017 16:27:10 -0600 Michael Sartain wrote: > > > - memcpy(option->data, data, size); > > > + > > > + /* Some IDs (like TRACECMD_OPTION_TRACECLOCK) pass NULL data */ > > > + if (data) > > > + memcpy(option->data, data, size); > > > > Is this a problem, as when this happens, size should be zero. Does it > > crash with data=NULL and size=0, or have you seen size not be zero? > > I got an ASAN warning, but you are correct - the size was 0 and it did > not crash. OK, but it's almost like dividing zero from zero. Can you send another patch, but this time check if (size) instead of if (data). -- Steve