From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964954AbcBCVNQ (ORCPT ); Wed, 3 Feb 2016 16:13:16 -0500 Received: from www62.your-server.de ([213.133.104.62]:53247 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932699AbcBCVNO (ORCPT ); Wed, 3 Feb 2016 16:13:14 -0500 Message-ID: <56B26D66.7060309@iogearbox.net> Date: Wed, 03 Feb 2016 22:13:10 +0100 From: Daniel Borkmann User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Joe Perches , "Jason A. Donenfeld" , akpm@linux-foundation.org, linux@rasmusvillemoes.dk, andriy.shevchenko@linux.intel.com, linux-kernel@vger.kernel.org, dborkman@redhat.com Subject: Re: IRe: [PATCH] vsprintf: flowinfo in IPv6 is optional too References: <1454496118-26370-1-git-send-email-Jason@zx2c4.com> <1454501601-28480-1-git-send-email-Jason@zx2c4.com> <1454522199.7291.103.camel@perches.com> In-Reply-To: <1454522199.7291.103.camel@perches.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/03/2016 06:56 PM, Joe Perches wrote: > On Wed, 2016-02-03 at 13:13 +0100, Jason A. Donenfeld wrote: >> Signed-off-by: Jason A. Donenfeld >> --- >> lib/vsprintf.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/lib/vsprintf.c b/lib/vsprintf.c >> index 1b1b1c8..85e6645 100644 >> --- a/lib/vsprintf.c >> +++ b/lib/vsprintf.c >> @@ -1189,7 +1189,7 @@ char *ip6_addr_string_sa(char *buf, char *end, const struct sockaddr_in6 *sa, >> *p++ = ':'; >> p = number(p, pend, ntohs(sa->sin6_port), spec); >> } >> - if (have_f) { >> + if (have_f && (sa->sin6_flowinfo & IPV6_FLOWINFO_MASK)) { >> *p++ = '/'; >> p = number(p, pend, ntohl(sa->sin6_flowinfo & >> IPV6_FLOWINFO_MASK), spec); > > Why does this matter at all? > > The format string "%pIS[...]f" is not used currently in the kernel. > > If one were to call out this 'f' qualifier to %pIS, wouldn't it > be better to show /0 than elide the / output completely? +1 Another possibility also in regards to your other patch would be to have a different format string char option instead of 'f'/'s' that would then allow a developer for having both options to choose from. Dunno if it's really worth it, but if you have a use case that definitely needs it, then it'd be probably better. Less surprises during debugging, at least.