public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH iwl-net v2] ice: dpll: Fix compilation warning
@ 2026-02-23 14:31 Przemyslaw Korba
  2026-02-24  8:57 ` [Intel-wired-lan] " Przemek Kitszel
  2026-02-25  9:59 ` Simon Horman
  0 siblings, 2 replies; 6+ messages in thread
From: Przemyslaw Korba @ 2026-02-23 14:31 UTC (permalink / raw)
  To: intel-wired-lan
  Cc: netdev, anthony.l.nguyen, przemyslaw.kitszel, Przemyslaw Korba

ice_dpll.c: In function ‘ice_dpll_init’:
ice_dpll.c:3588:59: error: ‘%u’ directive output may be truncated
writing between 1 and 10 bytes into a region of size 4
[-Werror=format-truncation=] snprintf(pin_name, sizeof(pin_name),
"rclk%u", i);

Fixes: ad1df4f2d591 ("ice: dpll: Support E825-C SyncE and dynamic pin discovery")
Signed-off-by: Przemyslaw Korba <przemyslaw.korba@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_dpll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_dpll.c b/drivers/net/ethernet/intel/ice/ice_dpll.c
index 73a4e28ed75f..f101fdb3e9cf 100644
--- a/drivers/net/ethernet/intel/ice/ice_dpll.c
+++ b/drivers/net/ethernet/intel/ice/ice_dpll.c
@@ -3532,7 +3532,7 @@ static int
 ice_dpll_init_fwnode_pins(struct ice_pf *pf, struct ice_dpll_pin *pins,
 			  int start_idx)
 {
-	char pin_name[8];
+	char pin_name[16];
 	int i, ret;
 
 	pf->dplls.wq = create_singlethread_workqueue("ice_dpll_wq");

base-commit: af960c69349a922fac3b4fbdb42e118a35c8700f
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Intel-wired-lan] [PATCH iwl-net v2] ice: dpll: Fix compilation warning
  2026-02-23 14:31 [PATCH iwl-net v2] ice: dpll: Fix compilation warning Przemyslaw Korba
@ 2026-02-24  8:57 ` Przemek Kitszel
  2026-03-02 12:01   ` Korba, Przemyslaw
  2026-02-25  9:59 ` Simon Horman
  1 sibling, 1 reply; 6+ messages in thread
From: Przemek Kitszel @ 2026-02-24  8:57 UTC (permalink / raw)
  To: Przemyslaw Korba; +Cc: netdev, anthony.l.nguyen, intel-wired-lan

On 2/23/26 15:31, Przemyslaw Korba wrote:
> ice_dpll.c: In function ‘ice_dpll_init’:
> ice_dpll.c:3588:59: error: ‘%u’ directive output may be truncated
> writing between 1 and 10 bytes into a region of size 4
> [-Werror=format-truncation=] snprintf(pin_name, sizeof(pin_name),
> "rclk%u", i);
> 
> Fixes: ad1df4f2d591 ("ice: dpll: Support E825-C SyncE and dynamic pin discovery")

thank you for the fix
this is a correct tag, and a correct target

> Signed-off-by: Przemyslaw Korba <przemyslaw.korba@intel.com>
> ---
>   drivers/net/ethernet/intel/ice/ice_dpll.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_dpll.c b/drivers/net/ethernet/intel/ice/ice_dpll.c
> index 73a4e28ed75f..f101fdb3e9cf 100644
> --- a/drivers/net/ethernet/intel/ice/ice_dpll.c
> +++ b/drivers/net/ethernet/intel/ice/ice_dpll.c
> @@ -3532,7 +3532,7 @@ static int
>   ice_dpll_init_fwnode_pins(struct ice_pf *pf, struct ice_dpll_pin *pins,
>   			  int start_idx)
>   {
> -	char pin_name[8];
> +	char pin_name[16];
>   	int i, ret;
>   
>   	pf->dplls.wq = create_singlethread_workqueue("ice_dpll_wq");

3537│         for (i = 0; i < pf->dplls.rclk.num_parents; i++) {

upper bound of the loop is u8 (ok), but we assign it as an int (good)

3538│                 pins[start_idx + i].pf = pf;
3539│                 snprintf(pin_name, sizeof(pin_name), "rclk%u", i);

compiler tries to be too smart here


anyway, it's better to have that warning gone instead of waiting for
a fix in the compiler

Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iwl-net v2] ice: dpll: Fix compilation warning
  2026-02-23 14:31 [PATCH iwl-net v2] ice: dpll: Fix compilation warning Przemyslaw Korba
  2026-02-24  8:57 ` [Intel-wired-lan] " Przemek Kitszel
@ 2026-02-25  9:59 ` Simon Horman
  2026-03-02 12:01   ` Korba, Przemyslaw
  1 sibling, 1 reply; 6+ messages in thread
From: Simon Horman @ 2026-02-25  9:59 UTC (permalink / raw)
  To: Przemyslaw Korba
  Cc: intel-wired-lan, netdev, anthony.l.nguyen, przemyslaw.kitszel

On Mon, Feb 23, 2026 at 03:31:55PM +0100, Przemyslaw Korba wrote:
> ice_dpll.c: In function ‘ice_dpll_init’:
> ice_dpll.c:3588:59: error: ‘%u’ directive output may be truncated
> writing between 1 and 10 bytes into a region of size 4
> [-Werror=format-truncation=] snprintf(pin_name, sizeof(pin_name),
> "rclk%u", i);
> 
> Fixes: ad1df4f2d591 ("ice: dpll: Support E825-C SyncE and dynamic pin discovery")
> Signed-off-by: Przemyslaw Korba <przemyslaw.korba@intel.com>

Hi Przemyslaw,

I agree that it is good to address this problem.
But is it a bug?

It seems to me that of the 8 bytes of pin_name, three are available for %u.
So values up to 999 can be safely formatted.  And I suspect that
pf->dplls.rclk.num_parents is always significantly smaller than that.

If so, I'd suggest this is iwl-next material. And should not have
a Fixes tag. But you could cite the commit that introduced the problem
something like this (the part starting with 'commit' is the syntax for
citing commits):

Introduced by commit ad1df4f2d591 ("ice: dpll: Support E825-C SyncE and
dynamic pin discovery")

...

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH iwl-net v2] ice: dpll: Fix compilation warning
  2026-02-25  9:59 ` Simon Horman
@ 2026-03-02 12:01   ` Korba, Przemyslaw
  2026-03-02 14:04     ` Simon Horman
  0 siblings, 1 reply; 6+ messages in thread
From: Korba, Przemyslaw @ 2026-03-02 12:01 UTC (permalink / raw)
  To: Simon Horman
  Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
	Nguyen, Anthony L, Kitszel, Przemyslaw

> From: Simon Horman <horms@kernel.org>
> Sent: Wednesday, February 25, 2026 11:00 AM
> To: Korba, Przemyslaw <przemyslaw.korba@intel.com>
> Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@intel.com>
> Subject: Re: [PATCH iwl-net v2] ice: dpll: Fix compilation warning
> 
> On Mon, Feb 23, 2026 at 03:31:55PM +0100, Przemyslaw Korba wrote:
> > ice_dpll.c: In function ‘ice_dpll_init’:
> > ice_dpll.c:3588:59: error: ‘%u’ directive output may be truncated
> > writing between 1 and 10 bytes into a region of size 4
> > [-Werror=format-truncation=] snprintf(pin_name, sizeof(pin_name),
> > "rclk%u", i);
> >
> > Fixes: ad1df4f2d591 ("ice: dpll: Support E825-C SyncE and dynamic pin discovery")
> > Signed-off-by: Przemyslaw Korba <przemyslaw.korba@intel.com>
> 
> Hi Przemyslaw,
> 
> I agree that it is good to address this problem.
> But is it a bug?
> 
> It seems to me that of the 8 bytes of pin_name, three are available for %u.
> So values up to 999 can be safely formatted.  And I suspect that
> pf->dplls.rclk.num_parents is always significantly smaller than that.
> 
> If so, I'd suggest this is iwl-next material. And should not have
> a Fixes tag. But you could cite the commit that introduced the problem
> something like this (the part starting with 'commit' is the syntax for
> citing commits):
> 
> Introduced by commit ad1df4f2d591 ("ice: dpll: Support E825-C SyncE and
> dynamic pin discovery")
> 

Thank you! I sent it to next, with updated commit message 😊

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [Intel-wired-lan] [PATCH iwl-net v2] ice: dpll: Fix compilation warning
  2026-02-24  8:57 ` [Intel-wired-lan] " Przemek Kitszel
@ 2026-03-02 12:01   ` Korba, Przemyslaw
  0 siblings, 0 replies; 6+ messages in thread
From: Korba, Przemyslaw @ 2026-03-02 12:01 UTC (permalink / raw)
  To: Kitszel, Przemyslaw
  Cc: netdev@vger.kernel.org, Nguyen, Anthony L,
	intel-wired-lan@lists.osuosl.org

> From: Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>
> Sent: Tuesday, February 24, 2026 9:57 AM
> To: Korba, Przemyslaw <przemyslaw.korba@intel.com>
> Cc: netdev@vger.kernel.org; Nguyen, Anthony L <anthony.l.nguyen@intel.com>; intel-wired-lan@lists.osuosl.org
> Subject: Re: [Intel-wired-lan] [PATCH iwl-net v2] ice: dpll: Fix compilation warning
> 
> On 2/23/26 15:31, Przemyslaw Korba wrote:
> > ice_dpll.c: In function ‘ice_dpll_init’:
> > ice_dpll.c:3588:59: error: ‘%u’ directive output may be truncated
> > writing between 1 and 10 bytes into a region of size 4
> > [-Werror=format-truncation=] snprintf(pin_name, sizeof(pin_name),
> > "rclk%u", i);
> >
> > Fixes: ad1df4f2d591 ("ice: dpll: Support E825-C SyncE and dynamic pin discovery")
> 
> thank you for the fix
> this is a correct tag, and a correct target
> 
> > Signed-off-by: Przemyslaw Korba <przemyslaw.korba@intel.com>
> > ---
> >   drivers/net/ethernet/intel/ice/ice_dpll.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/intel/ice/ice_dpll.c b/drivers/net/ethernet/intel/ice/ice_dpll.c
> > index 73a4e28ed75f..f101fdb3e9cf 100644
> > --- a/drivers/net/ethernet/intel/ice/ice_dpll.c
> > +++ b/drivers/net/ethernet/intel/ice/ice_dpll.c
> > @@ -3532,7 +3532,7 @@ static int
> >   ice_dpll_init_fwnode_pins(struct ice_pf *pf, struct ice_dpll_pin *pins,
> >   			  int start_idx)
> >   {
> > -	char pin_name[8];
> > +	char pin_name[16];
> >   	int i, ret;
> >
> >   	pf->dplls.wq = create_singlethread_workqueue("ice_dpll_wq");
> 
> 3537│         for (i = 0; i < pf->dplls.rclk.num_parents; i++) {
> 
> upper bound of the loop is u8 (ok), but we assign it as an int (good)
> 
> 3538│                 pins[start_idx + i].pf = pf;
> 3539│                 snprintf(pin_name, sizeof(pin_name), "rclk%u", i);
> 
> compiler tries to be too smart here
> 
> 
> anyway, it's better to have that warning gone instead of waiting for
> a fix in the compiler
> 
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>

Thank you very much for the review 😊

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH iwl-net v2] ice: dpll: Fix compilation warning
  2026-03-02 12:01   ` Korba, Przemyslaw
@ 2026-03-02 14:04     ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2026-03-02 14:04 UTC (permalink / raw)
  To: Korba, Przemyslaw
  Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
	Nguyen, Anthony L, Kitszel, Przemyslaw

On Mon, Mar 02, 2026 at 12:01:12PM +0000, Korba, Przemyslaw wrote:
> > From: Simon Horman <horms@kernel.org>
> > Sent: Wednesday, February 25, 2026 11:00 AM
> > To: Korba, Przemyslaw <przemyslaw.korba@intel.com>
> > Cc: intel-wired-lan@lists.osuosl.org; netdev@vger.kernel.org; Nguyen, Anthony L <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw
> > <przemyslaw.kitszel@intel.com>
> > Subject: Re: [PATCH iwl-net v2] ice: dpll: Fix compilation warning
> > 
> > On Mon, Feb 23, 2026 at 03:31:55PM +0100, Przemyslaw Korba wrote:
> > > ice_dpll.c: In function ‘ice_dpll_init’:
> > > ice_dpll.c:3588:59: error: ‘%u’ directive output may be truncated
> > > writing between 1 and 10 bytes into a region of size 4
> > > [-Werror=format-truncation=] snprintf(pin_name, sizeof(pin_name),
> > > "rclk%u", i);
> > >
> > > Fixes: ad1df4f2d591 ("ice: dpll: Support E825-C SyncE and dynamic pin discovery")
> > > Signed-off-by: Przemyslaw Korba <przemyslaw.korba@intel.com>
> > 
> > Hi Przemyslaw,
> > 
> > I agree that it is good to address this problem.
> > But is it a bug?
> > 
> > It seems to me that of the 8 bytes of pin_name, three are available for %u.
> > So values up to 999 can be safely formatted.  And I suspect that
> > pf->dplls.rclk.num_parents is always significantly smaller than that.
> > 
> > If so, I'd suggest this is iwl-next material. And should not have
> > a Fixes tag. But you could cite the commit that introduced the problem
> > something like this (the part starting with 'commit' is the syntax for
> > citing commits):
> > 
> > Introduced by commit ad1df4f2d591 ("ice: dpll: Support E825-C SyncE and
> > dynamic pin discovery")
> > 
> 
> Thank you! I sent it to next, with updated commit message 😊

Thanks, much appreciated.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-02 14:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-23 14:31 [PATCH iwl-net v2] ice: dpll: Fix compilation warning Przemyslaw Korba
2026-02-24  8:57 ` [Intel-wired-lan] " Przemek Kitszel
2026-03-02 12:01   ` Korba, Przemyslaw
2026-02-25  9:59 ` Simon Horman
2026-03-02 12:01   ` Korba, Przemyslaw
2026-03-02 14:04     ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox