From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DE24C169C4 for ; Wed, 6 Feb 2019 09:14:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 006E62175B for ; Wed, 6 Feb 2019 09:14:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727359AbfBFJOM (ORCPT ); Wed, 6 Feb 2019 04:14:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42576 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725897AbfBFJOM (ORCPT ); Wed, 6 Feb 2019 04:14:12 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4D43C10F91; Wed, 6 Feb 2019 09:14:12 +0000 (UTC) Received: from ovpn-204-136.brq.redhat.com (ovpn-204-136.brq.redhat.com [10.40.204.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 384EF604CC; Wed, 6 Feb 2019 09:14:10 +0000 (UTC) Message-ID: <11011cbd34985d06aef95165aa4d879980cb32c7.camel@redhat.com> Subject: Re: [PATCH iproute2-next] tc: full JSON support for 'bpf' actions From: Davide Caratti To: David Ahern , Stephen Hemminger Cc: netdev@vger.kernel.org In-Reply-To: References: <20190205145359.74508b0e@hermes.lan> Organization: red hat Content-Type: text/plain; charset="UTF-8" Date: Wed, 06 Feb 2019 10:14:09 +0100 Mime-Version: 1.0 User-Agent: Evolution 3.30.3 (3.30.3-1.fc29) Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 06 Feb 2019 09:14:12 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, 2019-02-05 at 14:59 -0800, David Ahern wrote: > On 2/5/19 2:53 PM, Stephen Hemminger wrote: > > On Thu, 31 Jan 2019 18:58:09 +0100 > > Davide Caratti wrote: > > > > > + print_uint(PRINT_ANY, "code", "%hu ", ops[i].code); > > > + print_uint(PRINT_ANY, "jt", "%hhu ", ops[i].jt); > > > + print_uint(PRINT_ANY, "jf", "%hhu ", ops[i].jf); > > > > Did you know that print_uint promotes the argument to unsigned int this happens frequently in iproute2 code, > > then you are printing it with %hhu which expects only a u8. but indeed, %hu and %hhu made the former cast just useless: thanks for noticing. > I did look at the print_hhu option and it seems really weird that you > use "print_hhu(..., "%hhu", ...)" which is why I took the patch as is. > There are existing examples of print_uint with '%hu' too. > The print_ functions really should be renamed (print_uchar, > print_ushort, etc). maybe this can be done more reliably with an automatic tool, like coccinelle. There are only 5 lines with the print_uint(... "%hu" ...) pattern, so this can be uniformed easily with a small patch. -- davide