Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1716581

RE: [PATCH net] ethernet: xircom: small clean up in setup_xirc2ps_cs()

From David Laight <David.Laight@ACULAB.COM>
Newsgroups linux.kernel
Subject RE: [PATCH net] ethernet: xircom: small clean up in setup_xirc2ps_cs()
Date 2017-08-21 17:00 +0200
Message-ID <ugWlk-5F5-31@gated-at.bofh.it> (permalink)
References <ugRvk-2Gw-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[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

csiph-web