From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 796EB33062 for ; Fri, 20 Dec 2024 16:30:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734712262; cv=none; b=t6r22uSfx26gv0GurvuzgqmKEWjpixF5QYE5MUv7QlWVY8Vc+k/Im6pu27ZTODG0M+5UatR0IfQKLeFAAv4Lu24VG552DbuCyJ9nEm+Wk1tpM1trDGwaO0d4d8Jd4SocL7HZeSbGLDHH3WiDTmK8cNa3ie3IyzYv55t1aoYihOw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734712262; c=relaxed/simple; bh=/tWzHMh4g9FVVPDXbSszYGrI6uTYCicnCqJpSJCmmhM=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DOsbzJA+bgDBbl8WnwPmxGj/7UTByLKmvnrKfMrnSo/LNZWKSfrFmKyt0xf8O91vayJ+pC8euyLQLj9eGELBL1ELquyPtF6kIUNfnszUScCUh4xEz5huGx5GMn878oGOtEVWwX+psdWWguABPhVtBkckkYBFHGcHE8dZNePymb4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lMZWgbSM; arc=none smtp.client-ip=209.85.221.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lMZWgbSM" Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-3862b364538so1233205f8f.1 for ; Fri, 20 Dec 2024 08:30:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734712258; x=1735317058; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=ys/Cf5TzonEK4BqNTE0TisMQIDKQfjwPaUSyGPP2aqY=; b=lMZWgbSMldSLjmASLznF9kTLbnRSoAefvwwFyI0BCGAmCp9X6rPt8iTEGt/hUCX05+ saNgfzxvKgNi5IO0cqqE2TlR75a2DSrn/6GQ8yJHZQfOePbcPHiGTb4yOi0R835r5cJr SFv09GvEdDbYM8nz+vDhR1G/UyIW0336BEGyLPMg3TRdmuLaX/egNAFIUSVSdivgnAVS n+xQn/JEXhMxCJp6SQKwS+QIBZjmOqXlLCH/czNrH87tw9sUhWVGTtJHfnH3uGcvoJAB gra2xCzOp6tolfloeTomso2L7QcKoAvmq9ZahQLcR8T4nF9d+5G8a0FIIqpnwM/VJkBj PPRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734712258; x=1735317058; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ys/Cf5TzonEK4BqNTE0TisMQIDKQfjwPaUSyGPP2aqY=; b=Qbueposbs/qqz4IfyJlH5nTsYMUL9AyUVw67bCuEYH/rLv10u7WvuhTC1VpooF0Nuu c6/Yw+EhqSvYanoU71jrtm2cMSLkR7tOeXR2egLFfSCuevUP54jNWxCZSCiLa9vT3okB OxcSaxbXSR2nfuTjBJMwNSwFbujt6bvrVJC9iETmW1XmXsZwjPM9CpDjseKbd0MZsr4z r2WGNT/ZERPlwrAdYU2kaWcen195bBm/1Aeawy0+QboiZNh0/QTxPy7lGQGDTouTEBGA i5totKUnt/ulmYFMYdRXYE8iLCY9SUg0/h4MdO5xRYMIl8SxsAZqSz9jHBAxgO20ai4b /ibg== X-Forwarded-Encrypted: i=1; AJvYcCV09HNo+bfnQzkovfeR7dhD5T/p5+U8RMvGxfpgyo0SW5oRb6URGL65HL9ZEmv+vOmVEZs6BAp+z49qT9Q=@vger.kernel.org X-Gm-Message-State: AOJu0YzRHsne1x/J4hLPyFXvwcIJTIxJPTI8FQ2x8ioMxORLt77VNJGP us3XCS45zdNilY3WH3Nc9Oe9CFJX+aDfPmNz7N137u4wArKTHFqaQTUSTxrZ X-Gm-Gg: ASbGncs6dR9Bom0EE2414yN5UxeWY7F3r0GRsDVNcspO53W/yATIPeKnRHH3HSMWAB5 ynWIU69LriHw4ej8J9mCqpMlmOAC7ugId8C4m+yh42l5nL27DG+ITkY+eab1MpXTtGRSpv1kCqy nyr6W+Zb3VbX22zAIRIatM1ESZBaNuIWBCy9ho3Co+2J87cKnJPnMu2Tz0ih1Qj87dRJdfRXA8w Tpkn3knbOb3+Po55iBd+uRhO8yJVHffOTMvReeoigQZ2BNOrdteW+aNvcnSt1TWd2/E7YADGD9L 3Gacmfng1h6Vh576z+aT8zU= X-Google-Smtp-Source: AGHT+IEEww8vXlz80Gut/Cl9tQP1T2MHpQ3Sk0POjZ6qvj24VIMFIW25rpndW/pHoA+dcPxCnxjiig== X-Received: by 2002:a5d:5f8c:0:b0:385:fa26:f0b5 with SMTP id ffacd0b85a97d-38a22a4c3camr2958336f8f.20.1734712257631; Fri, 20 Dec 2024 08:30:57 -0800 (PST) Received: from dsl-u17-10 (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c8b874asm4384714f8f.109.2024.12.20.08.30.57 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Dec 2024 08:30:57 -0800 (PST) Date: Fri, 20 Dec 2024 16:30:56 +0000 From: David Laight To: Guenter Roeck Cc: kernel test robot , Eddie James , oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: drivers/hwmon/pmbus/ibm-cffps.c:184:60: warning: '%04X' directive output may be truncated writing between 4 and 8 bytes into a region of size 5 Message-ID: <20241220163056.7bad4962@dsl-u17-10> In-Reply-To: References: <202412202139.tZ2VJL2f-lkp@intel.com> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 20 Dec 2024 07:21:18 -0800 Guenter Roeck wrote: > On 12/20/24 05:54, kernel test robot wrote: > > Hi Eddie, > > > > FYI, the error/warning still remains. > > > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master > > head: 8faabc041a001140564f718dabe37753e88b37fa > > commit: 2f8a855efe8a6faf962c53af406e5ea4791b3877 pmbus: (ibm-cffps) Add support for version 2 of the PSU > > date: 5 years ago > > config: x86_64-randconfig-077-20241209 (https://download.01.org/0day-ci/archive/20241220/202412202139.tZ2VJL2f-lkp@intel.com/config) > > compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 > > reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241220/202412202139.tZ2VJL2f-lkp@intel.com/reproduce) > > > > If you fix the issue in a separate patch/commit (i.e. not just a new version of > > the same patch/commit), kindly add following tags > > | Reported-by: kernel test robot > > | Closes: https://lore.kernel.org/oe-kbuild-all/202412202139.tZ2VJL2f-lkp@intel.com/ > > > > We could use %2. 2X and %4.4X to make the compiler happy, but those are false positives. > rc is known in all cases to not exceed the format size. I don't see the point of changing > the code just to make the compiler happy. I doubt they'd make any difference. > > > drivers/hwmon/pmbus/ibm-cffps.c:171:60: warning: '%02X' directive output may be truncated writing between 2 and 8 bytes into a region of size 3 [-Wformat-truncation=] > > 171 | snprintf(&data[i * 2], 3, "%02X", rc); The only ways I know are to bound check the value or to use OPTIMISER_HIDE_VAR() on the length. David