mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next v1] drivers/net/ethernet/intel/e100: check the return value of e100_exec_cmd()
@ 2022-09-09  4:16 Li Zhong
  2022-09-12 22:08 ` Tony Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Li Zhong @ 2022-09-09  4:16 UTC (permalink / raw)
  To: linux-kernel, netdev, intel-wired-lan
  Cc: pabeni, kuba, edumazet, davem, anthony.l.nguyen,
	jesse.brandeburg, Li Zhong

Check the return value of e100_exec_cmd() which could return error code
when execution fails.

Signed-off-by: Li Zhong <floridsleeves@gmail.com>
---
 drivers/net/ethernet/intel/e100.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
index 11a884aa5082..3b84745376fe 100644
--- a/drivers/net/ethernet/intel/e100.c
+++ b/drivers/net/ethernet/intel/e100.c
@@ -1911,7 +1911,8 @@ static inline void e100_start_receiver(struct nic *nic, struct rx *rx)
 
 	/* (Re)start RU if suspended or idle and RFA is non-NULL */
 	if (rx->skb) {
-		e100_exec_cmd(nic, ruc_start, rx->dma_addr);
+		if (!e100_exec_cmd(nic, ruc_start, rx->dma_addr))
+			return;
 		nic->ru_running = RU_RUNNING;
 	}
 }
-- 
2.25.1


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

* Re: [PATCH net-next v1] drivers/net/ethernet/intel/e100: check the return value of e100_exec_cmd()
  2022-09-09  4:16 [PATCH net-next v1] drivers/net/ethernet/intel/e100: check the return value of e100_exec_cmd() Li Zhong
@ 2022-09-12 22:08 ` Tony Nguyen
  2022-09-17  0:02   ` Li Zhong
  0 siblings, 1 reply; 3+ messages in thread
From: Tony Nguyen @ 2022-09-12 22:08 UTC (permalink / raw)
  To: Li Zhong, linux-kernel, netdev, intel-wired-lan
  Cc: pabeni, kuba, edumazet, davem, jesse.brandeburg

On 9/8/2022 9:16 PM, Li Zhong wrote:
> Check the return value of e100_exec_cmd() which could return error code
> when execution fails.

Are you coming across this as a real bug or as something reported by 
static analysis? If the latter, I suggest checking the return value and 
reporting it as debug, however, not changing existing behavior. We don't 
have validation on this driver so there is limited ability to check for 
regressions and the code has been like this for a long time without 
reported issues.

Thanks,
Tony

> Signed-off-by: Li Zhong <floridsleeves@gmail.com>
> ---
>   drivers/net/ethernet/intel/e100.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
> index 11a884aa5082..3b84745376fe 100644
> --- a/drivers/net/ethernet/intel/e100.c
> +++ b/drivers/net/ethernet/intel/e100.c
> @@ -1911,7 +1911,8 @@ static inline void e100_start_receiver(struct nic *nic, struct rx *rx)
>   
>   	/* (Re)start RU if suspended or idle and RFA is non-NULL */
>   	if (rx->skb) {
> -		e100_exec_cmd(nic, ruc_start, rx->dma_addr);
> +		if (!e100_exec_cmd(nic, ruc_start, rx->dma_addr))
> +			return;
>   		nic->ru_running = RU_RUNNING;
>   	}
>   }

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

* Re: [PATCH net-next v1] drivers/net/ethernet/intel/e100: check the return value of e100_exec_cmd()
  2022-09-12 22:08 ` Tony Nguyen
@ 2022-09-17  0:02   ` Li Zhong
  0 siblings, 0 replies; 3+ messages in thread
From: Li Zhong @ 2022-09-17  0:02 UTC (permalink / raw)
  To: Tony Nguyen
  Cc: linux-kernel, netdev, intel-wired-lan, pabeni, kuba, edumazet,
	davem, jesse.brandeburg

On Mon, Sep 12, 2022 at 3:08 PM Tony Nguyen <anthony.l.nguyen@intel.com> wrote:
>
> On 9/8/2022 9:16 PM, Li Zhong wrote:
> > Check the return value of e100_exec_cmd() which could return error code
> > when execution fails.
>
> Are you coming across this as a real bug or as something reported by
> static analysis? If the latter, I suggest checking the return value and
> reporting it as debug, however, not changing existing behavior. We don't
> have validation on this driver so there is limited ability to check for
> regressions and the code has been like this for a long time without
> reported issues.

Thanks for replying and suggestions! This is detected by static analysis.
I submit a v2 patch that fixes it as debug printk.

>
> Thanks,
> Tony
>
> > Signed-off-by: Li Zhong <floridsleeves@gmail.com>
> > ---
> >   drivers/net/ethernet/intel/e100.c | 3 ++-
> >   1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/intel/e100.c b/drivers/net/ethernet/intel/e100.c
> > index 11a884aa5082..3b84745376fe 100644
> > --- a/drivers/net/ethernet/intel/e100.c
> > +++ b/drivers/net/ethernet/intel/e100.c
> > @@ -1911,7 +1911,8 @@ static inline void e100_start_receiver(struct nic *nic, struct rx *rx)
> >
> >       /* (Re)start RU if suspended or idle and RFA is non-NULL */
> >       if (rx->skb) {
> > -             e100_exec_cmd(nic, ruc_start, rx->dma_addr);
> > +             if (!e100_exec_cmd(nic, ruc_start, rx->dma_addr))
> > +                     return;
> >               nic->ru_running = RU_RUNNING;
> >       }
> >   }

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

end of thread, other threads:[~2022-09-17  0:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-09  4:16 [PATCH net-next v1] drivers/net/ethernet/intel/e100: check the return value of e100_exec_cmd() Li Zhong
2022-09-12 22:08 ` Tony Nguyen
2022-09-17  0:02   ` Li Zhong

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

all inboxes | Powered by JetHome®