* [PATCH net] ethernet: xircom: small clean up in setup_xirc2ps_cs()
@ 2017-08-21 9:47 Dan Carpenter
2017-08-21 14:52 ` David Laight
2017-08-22 17:30 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: Dan Carpenter @ 2017-08-21 9:47 UTC (permalink / raw)
To: Jarod Wilson
Cc: David S. Miller, netdev, kernel-janitors, Ilya Matveychikov,
Baoquan He, Andrew Morton, Ingo Molnar, linux-kernel
The get_options() function takes the whole ARRAY_SIZE(). It doesn't
matter here because we don't use more than 7 elements.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/net/ethernet/xircom/xirc2ps_cs.c b/drivers/net/ethernet/xircom/xirc2ps_cs.c
index f71883264cc0..fd5288ff53b5 100644
--- a/drivers/net/ethernet/xircom/xirc2ps_cs.c
+++ b/drivers/net/ethernet/xircom/xirc2ps_cs.c
@@ -1781,7 +1781,7 @@ static int __init setup_xirc2ps_cs(char *str)
*/
int ints[10] = { -1 };
- str = get_options(str, 9, ints);
+ str = get_options(str, ARRAY_SIZE(ints), ints);
#define MAYBE_SET(X,Y) if (ints[0] >= Y && ints[Y] != -1) { X = ints[Y]; }
MAYBE_SET(if_port, 3);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH net] ethernet: xircom: small clean up in setup_xirc2ps_cs()
2017-08-21 9:47 [PATCH net] ethernet: xircom: small clean up in setup_xirc2ps_cs() Dan Carpenter
@ 2017-08-21 14:52 ` David Laight
2017-08-21 14:56 ` Dan Carpenter
2017-08-22 17:30 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: David Laight @ 2017-08-21 14:52 UTC (permalink / raw)
To: 'Dan Carpenter', Jarod Wilson
Cc: David S. Miller, netdev@vger.kernel.org,
kernel-janitors@vger.kernel.org, Ilya Matveychikov, Baoquan He,
Andrew Morton, Ingo Molnar, linux-kernel@vger.kernel.org
From: Dan Carpenter
> Sent: 21 August 2017 10:48
> The get_options() function takes the whole ARRAY_SIZE(). It doesn't
> matter here because we don't use more than 7 elements.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/net/ethernet/xircom/xirc2ps_cs.c b/drivers/net/ethernet/xircom/xirc2ps_cs.c
> index f71883264cc0..fd5288ff53b5 100644
> --- a/drivers/net/ethernet/xircom/xirc2ps_cs.c
> +++ b/drivers/net/ethernet/xircom/xirc2ps_cs.c
> @@ -1781,7 +1781,7 @@ static int __init setup_xirc2ps_cs(char *str)
> */
> int ints[10] = { -1 };
>
> - str = get_options(str, 9, ints);
> + str = get_options(str, ARRAY_SIZE(ints), ints);
>
> #define MAYBE_SET(X,Y) if (ints[0] >= Y && ints[Y] != -1) { X = ints[Y]; }
> MAYBE_SET(if_port, 3);
That code looks very dubious to me.
It looks as though it expects all of the ints[] array to be initialised
to -1, not just the first element.
David
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] ethernet: xircom: small clean up in setup_xirc2ps_cs()
2017-08-21 14:52 ` David Laight
@ 2017-08-21 14:56 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2017-08-21 14:56 UTC (permalink / raw)
To: David Laight
Cc: Jarod Wilson, David S. Miller, netdev@vger.kernel.org,
kernel-janitors@vger.kernel.org, Ilya Matveychikov, Baoquan He,
Andrew Morton, Ingo Molnar, linux-kernel@vger.kernel.org
On Mon, Aug 21, 2017 at 02:52:34PM +0000, David Laight wrote:
> From: Dan Carpenter
> > Sent: 21 August 2017 10:48
> > The get_options() function takes the whole ARRAY_SIZE(). It doesn't
> > matter here because we don't use more than 7 elements.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > diff --git a/drivers/net/ethernet/xircom/xirc2ps_cs.c b/drivers/net/ethernet/xircom/xirc2ps_cs.c
> > index f71883264cc0..fd5288ff53b5 100644
> > --- a/drivers/net/ethernet/xircom/xirc2ps_cs.c
> > +++ b/drivers/net/ethernet/xircom/xirc2ps_cs.c
> > @@ -1781,7 +1781,7 @@ static int __init setup_xirc2ps_cs(char *str)
> > */
> > int ints[10] = { -1 };
> >
> > - str = get_options(str, 9, ints);
> > + str = get_options(str, ARRAY_SIZE(ints), ints);
> >
> > #define MAYBE_SET(X,Y) if (ints[0] >= Y && ints[Y] != -1) { X = ints[Y]; }
> > MAYBE_SET(if_port, 3);
>
> That code looks very dubious to me.
> It looks as though it expects all of the ints[] array to be initialised
> to -1, not just the first element.
I'm pretty sure you're right and I thought about changing it when I sent
the patch but it doesn't matter. It's not required to initialize that
code anyway because either get_options() will initialize it or it won't
be used.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] ethernet: xircom: small clean up in setup_xirc2ps_cs()
2017-08-21 9:47 [PATCH net] ethernet: xircom: small clean up in setup_xirc2ps_cs() Dan Carpenter
2017-08-21 14:52 ` David Laight
@ 2017-08-22 17:30 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2017-08-22 17:30 UTC (permalink / raw)
To: dan.carpenter
Cc: jarod, netdev, kernel-janitors, matvejchikov, bhe, akpm, mingo,
linux-kernel
From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Mon, 21 Aug 2017 12:47:30 +0300
> The get_options() function takes the whole ARRAY_SIZE(). It doesn't
> matter here because we don't use more than 7 elements.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-08-22 17:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-21 9:47 [PATCH net] ethernet: xircom: small clean up in setup_xirc2ps_cs() Dan Carpenter
2017-08-21 14:52 ` David Laight
2017-08-21 14:56 ` Dan Carpenter
2017-08-22 17:30 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).