Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1716251 > unrolled thread
| Started by | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| First post | 2017-08-21 11:50 +0200 |
| Last post | 2017-08-22 19:40 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH net] ethernet: xircom: small clean up in setup_xirc2ps_cs() Dan Carpenter <dan.carpenter@oracle.com> - 2017-08-21 11:50 +0200
Re: [PATCH net] ethernet: xircom: small clean up in setup_xirc2ps_cs() Dan Carpenter <dan.carpenter@oracle.com> - 2017-08-21 17:00 +0200
RE: [PATCH net] ethernet: xircom: small clean up in setup_xirc2ps_cs() David Laight <David.Laight@ACULAB.COM> - 2017-08-21 17:00 +0200
Re: [PATCH net] ethernet: xircom: small clean up in setup_xirc2ps_cs() David Miller <davem@davemloft.net> - 2017-08-22 19:40 +0200
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Date | 2017-08-21 11:50 +0200 |
| Subject | [PATCH net] ethernet: xircom: small clean up in setup_xirc2ps_cs() |
| Message-ID | <ugRvk-2Gw-9@gated-at.bofh.it> |
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);
[toc] | [next] | [standalone]
| From | Dan Carpenter <dan.carpenter@oracle.com> |
|---|---|
| Date | 2017-08-21 17:00 +0200 |
| Subject | Re: [PATCH net] ethernet: xircom: small clean up in setup_xirc2ps_cs() |
| Message-ID | <ugWlk-5F5-29@gated-at.bofh.it> |
| In reply to | #1716251 |
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
[toc] | [prev] | [next] | [standalone]
| From | David Laight <David.Laight@ACULAB.COM> |
|---|---|
| Date | 2017-08-21 17:00 +0200 |
| Subject | RE: [PATCH net] ethernet: xircom: small clean up in setup_xirc2ps_cs() |
| Message-ID | <ugWlk-5F5-31@gated-at.bofh.it> |
| In reply to | #1716251 |
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
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2017-08-22 19:40 +0200 |
| Subject | Re: [PATCH net] ethernet: xircom: small clean up in setup_xirc2ps_cs() |
| Message-ID | <uhljI-5x9-13@gated-at.bofh.it> |
| In reply to | #1716251 |
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.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web