From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v2] libxc: Fix buffer length for get_suspend_file Date: Tue, 18 Mar 2014 14:00:52 +0000 Message-ID: <53285194.907@linaro.org> References: <1395150873-9397-1-git-send-email-ian.jackson@eu.citrix.com> <1395151088-9724-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1395151088-9724-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: xen-devel@lists.xensource.com, Ian Campbell List-Id: xen-devel@lists.xenproject.org Hi Ian, On 03/18/2014 01:58 PM, Ian Jackson wrote: > Declaring a formal parameter to have an array type doesn't result in > the parameter actually having an array type. The type is "adjusted" > to a pointer. (C99 6.9.1(7), 6.7.5.3.) > > So the use of sizeof in xc_suspend.c:get_suspend_file was wrong. > Instead, use the #define. Also get rid of the array size, as it is > misleading. > > Newer versions of gcc warn about the erroneous code: > xc_suspend.c:39:25: error: argument to 'sizeof' in 'snprintf' call > is the same expression as the destination; did you mean to provide > an explicit length? [-Werror=sizeof-pointer-memaccess] > > Reported-By: Julien Grall > Signed-off-by: Ian Jackson > CC: Ian Campbell > CC: Julien Grall Great, I'm able to compile libxc with gcc 4.8: Tested-by: Julien Grall Regards, -- Julien Grall