Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754851AbdD0PED convert rfc822-to-8bit (ORCPT ); Thu, 27 Apr 2017 11:04:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40702 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756002AbdD0PDz (ORCPT ); Thu, 27 Apr 2017 11:03:55 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 83F4AC04BD53 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dhowells@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 83F4AC04BD53 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20170419203819.21951-1-jeremy.lefaure@lse.epita.fr> References: <20170419203819.21951-1-jeremy.lefaure@lse.epita.fr> To: =?us-ascii?Q?=3D=3FUTF-8=3Fq=3FJ=3DC3=3DA9r=3DC3=3DA9my=3D20Lefaure=3F?= =?us-ascii?Q?=3D?= Cc: dhowells@redhat.com, linux-cachefs@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] FS-Cache: print hexadecimal value for special cookies type MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Date: Thu, 27 Apr 2017 16:03:45 +0100 Message-ID: <28723.1493305425@warthog.procyon.org.uk> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 27 Apr 2017 15:03:55 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1177 Lines: 28 Jérémy Lefaure wrote: > When building object-list.o, gcc 6 raises a warning on the sprintf call > in fscache_objlist_show: > > CC fs/fscache/object-list.o > fs/fscache/object-list.c: In function ‘fscache_objlist_show’: > fs/fscache/object-list.c:265:19: warning: ‘sprintf’ may write a > terminating nul past the end of the destination [-Wformat-overflow=] > sprintf(_type, "%02u", cookie->def->type); > ^~~~~~ > fs/fscache/object-list.c:265:4: note: ‘sprintf’ output between 3 and 4 > bytes into a destination of size 3 > sprintf(_type, "%02u", cookie->def->type); > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Moreover, the documentation says that we should have an hex value for > special cookies (see Documentation/filesystems/caching/fscache.txt). > > Printing hexadecimal value for special cookies fixes the overflow > warning and complies with the documentation. Fine by me. We don't actually handle special type cookies at the moment, so you're not going to see anything other than DT or IX for now anyway. I'll push this in the next merge window if that's okay with you. David