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=-3.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=no 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 AAD7AC4708D for ; Fri, 28 May 2021 21:35:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 90679613B6 for ; Fri, 28 May 2021 21:35:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229616AbhE1Vgm (ORCPT ); Fri, 28 May 2021 17:36:42 -0400 Received: from smtprelay0027.hostedemail.com ([216.40.44.27]:51234 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229565AbhE1Vgk (ORCPT ); Fri, 28 May 2021 17:36:40 -0400 Received: from omf16.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay07.hostedemail.com (Postfix) with ESMTP id 8B11E181D3025; Fri, 28 May 2021 21:35:04 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf16.hostedemail.com (Postfix) with ESMTPA id 5A2292550F6; Fri, 28 May 2021 21:35:02 +0000 (UTC) Message-ID: Subject: Re: [PATCH] iio: si1133: fix format string warnings From: Joe Perches To: Andy Shevchenko Cc: Jonathan Cameron , Nathan Chancellor , Arnd Bergmann , Nick Desaulniers , Maxime =?ISO-8859-1?Q?Roussin-B=E9langer?= , Jean-Francois Dagenais , Arnd Bergmann , Lars-Peter Clausen , Alexandru Ardelean , "linux-iio@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "clang-built-linux@googlegroups.com" Date: Fri, 28 May 2021 14:35:01 -0700 In-Reply-To: References: <20210514135927.2926482-1-arnd@kernel.org> <7afc367b-8103-9d48-1bfe-d505d86553b9@kernel.org> <20210516103628.2cf899a0@jic23-huawei> <644a711e4d2639a23bfc50dffa180ad184a4acb1.camel@perches.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Stat-Signature: kkmhc1bttsasinfggbmtofn51u6bb65q X-Rspamd-Server: rspamout04 X-Rspamd-Queue-Id: 5A2292550F6 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+V3ZAlIxraiLN1BNQJiiyx7LjKDDaWv6E= X-HE-Tag: 1622237702-401044 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2021-05-29 at 00:16 +0300, Andy Shevchenko wrote: > On Saturday, May 29, 2021, Joe Perches wrote: [] > > > > Likely these should be 0x%02x > > > > > > What’s the difference (except printing 0)? > > > > (assuming the argument is unsigned char/u8) > > > > %#02x will always emit more than the specified length (3 or 4 chars) > > values < 16 are 0x, values >= 16 are 0x > > 0 will be 0, btw. Hey Andy. Right. > > 0x%02x will always emit 4 chars > > *Minimum* or at least 4 characters. There is an upper limit of sizeof(int) > * 2 + 2. I did write assuming the argument is unsigned char/u8. For the general unsigned int arg case, you are of course correct.