Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp113332imb; Thu, 28 Feb 2019 17:50:03 -0800 (PST) X-Google-Smtp-Source: APXvYqxBRtnHBcjvT1G25ic1U/DgieNLEKu95P1VjA+zkWmqzk+It8hR5h4DUZqPu6SYlUXse4w6 X-Received: by 2002:a62:788a:: with SMTP id t132mr2880261pfc.101.1551405003176; Thu, 28 Feb 2019 17:50:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551405003; cv=none; d=google.com; s=arc-20160816; b=w+oOuaz8iQX9N6ySKPnTbLBFgwLElfgNppkmT5dzsjeYvH5YffynibrKHYkXnKbdxq qBR7eo407nBHCPB8FqM0C/Qhfi2JI5flIHkO5IqPcdCtUtY1KBgUWOBtv5ZiKEXi147f hEmPX+2ApmFPJI4YkGFT3v1roQrydqKhTkqBK9GuK7u4N1Sj3kUOOoAwnPM3zSrYIYNr NKzbQTmGpDbsxmVIlv5/6t7Q3z67xb3zW4sdYoLy4V0rML6F4oIguBp3Rxr0j7BCbcYQ iiptua4DFv+Je6zZAO+9cMRvo6i+p5JTgrE+U2DMgBWB9FMP5PO8YJTDX2qNskwl4jhk T+Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=a6vEDFatUlLOOK2igagXUb55zWkg+bRViRuJMbK51Uo=; b=AJtn7felqyhPW/B/uK++9XSmobU8tL6pDC7rb49eqOWunrq6vGwuOPqtJ/GC8jWfIn IviHqCqJ2YZtDBeMpSokOs7cqHC2O401D+STH9phcCHmaOk2oOY8oEd4VrlUUS9TIvm3 M2rdXlWKfOvYwGjFzzdeJQ3TT1ealSZGmvFs5Z3pOqtZYP7Yk65s84zjGF6hEvSatPrO 6Dea1lS3cxTubmd9r8eVDAZ+FM/rpO/AEP8j8dlWSNgrCx9keZbi0Mx/K2W0j4Yf88Y+ xNvIcsT0i06vaQd9tpkACyNPE/8Skx1iSbnOdq0U4HRNHIKfXSqzop3lA/0YRVqVQPNK +R3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OKxZIXgK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m3si19813706pld.425.2019.02.28.17.49.48; Thu, 28 Feb 2019 17:50:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=OKxZIXgK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730884AbfCAAEM (ORCPT + 99 others); Thu, 28 Feb 2019 19:04:12 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:34115 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727806AbfCAAEM (ORCPT ); Thu, 28 Feb 2019 19:04:12 -0500 Received: by mail-lf1-f66.google.com with SMTP id u21so16677241lfu.1 for ; Thu, 28 Feb 2019 16:04:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=a6vEDFatUlLOOK2igagXUb55zWkg+bRViRuJMbK51Uo=; b=OKxZIXgKJNV8snaAaJcSo7zXKFCFJcEeCBoGHPZI/GeOevt8QjWJRFpZ8HBf2J3gai g1weTQd5urPtNkr9eQikm9UWRwg8TiM55ISxtIxRkecsQhmsirVjcJ6uhllXbzwl+ahs etcvG/LOEaNVOxu3UwjDk9t4ReIuaJjy7Hb2c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=a6vEDFatUlLOOK2igagXUb55zWkg+bRViRuJMbK51Uo=; b=ccqoAuq/MYNioKPRnFSY8mPjmTThrz/BLVek+PiOVBVe+Ki+7rWIItuXk680C4jb3a wSbVnIvJVJtIYs9fopS41RPpI5EQcjYtuqxI0rdiDgd8D3r+VdpWfoBiR9v6kjiZU5fY jThTKsNKVAAllBEGRvaMCYgx5+lQGqaxkz5n6grrk3nEaPpl35fbBCjdFkdCp+cH9AEx 8Kw+j468Ft2kEb/JElgv+TPeBnScbg5s9AKcu4YEHTXZbBKNMGiG43w5IHtFcczFlXYT VbSdmTt3i7a3/RhEFiLNlBfZqxA34vOtbORe1KMlK2Fim28v5k0EQ/TjsiZvCijNhI0o lDvQ== X-Gm-Message-State: APjAAAWcxiDugnlUQLzle5OUIbxrp6NbVko2CEf0WpfQHGzUkd4mN6Wp vVZLfjRxmXgutMsdupzv8b4T7KR1gEk= X-Received: by 2002:a19:f017:: with SMTP id p23mr1185218lfc.103.1551398649941; Thu, 28 Feb 2019 16:04:09 -0800 (PST) Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com. [209.85.167.53]) by smtp.gmail.com with ESMTPSA id x2sm4255486ljd.30.2019.02.28.16.04.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Feb 2019 16:04:08 -0800 (PST) Received: by mail-lf1-f53.google.com with SMTP id h10so16627328lfc.12 for ; Thu, 28 Feb 2019 16:04:07 -0800 (PST) X-Received: by 2002:a19:4948:: with SMTP id l8mr1300132lfj.156.1551398647297; Thu, 28 Feb 2019 16:04:07 -0800 (PST) MIME-Version: 1.0 References: <20190228115256.5446-1-louis@kragniz.eu> <20190228122417.9318-1-louis@kragniz.eu> <15c6689389503a82394bccb9204650bf20a7a6d3.camel@perches.com> <1450785b937f4a2b5f98c8548986b162684a719b.camel@perches.com> In-Reply-To: <1450785b937f4a2b5f98c8548986b162684a719b.camel@perches.com> From: Jon Flatley Date: Thu, 28 Feb 2019 16:03:55 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] wusb: use correct format characters To: Joe Perches Cc: Jon Flatley , Louis Taylor , gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, Linux Kernel Mailing List , clang-built-linux@googlegroups.com, Nick Desaulniers Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 28, 2019 at 3:05 PM Joe Perches wrote: > > On Thu, 2019-02-28 at 14:23 -0800, Jon Flatley wrote: > > Thanks for the patch and comments. > > > > On Thu, Feb 28, 2019 at 1:53 PM Joe Perches wrote: > > > On Thu, 2019-02-28 at 12:24 +0000, Louis Taylor wrote: > > > > When compiling with -Wformat, clang warns: > > > > ./include/linux/usb/wusb.h:245:5: warning: format specifies type > > > > 'unsigned short' but the argument has type 'u8' (aka 'unsigned char') > > > > [-Wformat] > > > > ckhdid->data[0], ckhdid->data[1], > > > > ^~~~~~~~~~~~~~~ > > > > > > I think the message is somewhat misguided as all the > > > vararg arguments have implicit integer promotions. > > > > That's a fair point, but Clang checks the arguments against their > > format specifier before they're promoted when using -Wformat. > > Perhaps clang could be a bit more verbose if > checking signed types emitted as unsigned or > unsigned types emitted as signed instead. It is a little strange that clang warns when the length specifier doesn't match but not when an unsigned specifier is used for a signed value and vice versa. > > > When > > considering integer promotions it's difficult to say if this is > > "wrong", > > I didn't write "wrong", I wrote misguided. Apologies for my poor wording. I meant "wrong" in the sense that it's unclear if an improper length specifier is deserving of a warning. After all GCC doesn't warn for incorrect length specifiers, and as you pointed out Clang doesn't pay attention to if the specifier expects a signed or unsigned value. Cheers, Jon