netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] defxx: Fix a sentinel at the end of a 'eisa_device_id' structure
@ 2020-02-02 14:23 Christophe JAILLET
  2020-02-02 19:12 ` Maciej W. Rozycki
  2020-02-03  9:55 ` Dan Carpenter
  0 siblings, 2 replies; 5+ messages in thread
From: Christophe JAILLET @ 2020-02-02 14:23 UTC (permalink / raw)
  To: macro, ralf, davem, akpm
  Cc: netdev, linux-kernel, kernel-janitors, Christophe JAILLET

'struct eisa_device_id' must be ended by an empty string, not a NULL
pointer. Otherwise, a NULL pointer dereference may occur in
'eisa_bus_match()'.

Also convert some spaces to tab to please 'checkpatch.pl'.

Fixes: e89a2cfb7d7b ("[TC] defxx: TURBOchannel support")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/net/fddi/defxx.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/fddi/defxx.c b/drivers/net/fddi/defxx.c
index 077c68498f04..7ef0c57f07c6 100644
--- a/drivers/net/fddi/defxx.c
+++ b/drivers/net/fddi/defxx.c
@@ -3768,11 +3768,11 @@ static void dfx_pci_unregister(struct pci_dev *pdev)
 
 #ifdef CONFIG_EISA
 static const struct eisa_device_id dfx_eisa_table[] = {
-        { "DEC3001", DEFEA_PROD_ID_1 },
-        { "DEC3002", DEFEA_PROD_ID_2 },
-        { "DEC3003", DEFEA_PROD_ID_3 },
-        { "DEC3004", DEFEA_PROD_ID_4 },
-        { }
+	{ "DEC3001", DEFEA_PROD_ID_1 },
+	{ "DEC3002", DEFEA_PROD_ID_2 },
+	{ "DEC3003", DEFEA_PROD_ID_3 },
+	{ "DEC3004", DEFEA_PROD_ID_4 },
+	{ "" }
 };
 MODULE_DEVICE_TABLE(eisa, dfx_eisa_table);
 
-- 
2.20.1


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

* Re: [PATCH] defxx: Fix a sentinel at the end of a 'eisa_device_id' structure
  2020-02-02 14:23 [PATCH] defxx: Fix a sentinel at the end of a 'eisa_device_id' structure Christophe JAILLET
@ 2020-02-02 19:12 ` Maciej W. Rozycki
  2020-02-03  9:55 ` Dan Carpenter
  1 sibling, 0 replies; 5+ messages in thread
From: Maciej W. Rozycki @ 2020-02-02 19:12 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Ralf Baechle, David S. Miller, Andrew Morton, netdev,
	linux-kernel, kernel-janitors

On Sun, 2 Feb 2020, Christophe JAILLET wrote:

> 'struct eisa_device_id' must be ended by an empty string, not a NULL
> pointer. Otherwise, a NULL pointer dereference may occur in
> 'eisa_bus_match()'.

 Umm, that's weird code there in `eisa_bus_match' (I do hope at least GCC 
optimises the `strlen' away nowadays and checks for the character pointed 
being null instead), but as usually with old stuff let's keep changes to 
the minimum.  So:

Acked-by: Maciej W. Rozycki <macro@linux-mips.org>

 Thanks for the fix!

  Maciej

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

* Re: [PATCH] defxx: Fix a sentinel at the end of a 'eisa_device_id' structure
  2020-02-02 14:23 [PATCH] defxx: Fix a sentinel at the end of a 'eisa_device_id' structure Christophe JAILLET
  2020-02-02 19:12 ` Maciej W. Rozycki
@ 2020-02-03  9:55 ` Dan Carpenter
  2020-02-03 10:20   ` Maciej W. Rozycki
  1 sibling, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2020-02-03  9:55 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: macro, ralf, davem, akpm, netdev, linux-kernel, kernel-janitors

On Sun, Feb 02, 2020 at 03:23:41PM +0100, Christophe JAILLET wrote:
> 'struct eisa_device_id' must be ended by an empty string, not a NULL
> pointer. Otherwise, a NULL pointer dereference may occur in
> 'eisa_bus_match()'.
> 
> Also convert some spaces to tab to please 'checkpatch.pl'.
> 
> Fixes: e89a2cfb7d7b ("[TC] defxx: TURBOchannel support")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>  drivers/net/fddi/defxx.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/fddi/defxx.c b/drivers/net/fddi/defxx.c
> index 077c68498f04..7ef0c57f07c6 100644
> --- a/drivers/net/fddi/defxx.c
> +++ b/drivers/net/fddi/defxx.c
> @@ -3768,11 +3768,11 @@ static void dfx_pci_unregister(struct pci_dev *pdev)
>  
>  #ifdef CONFIG_EISA
>  static const struct eisa_device_id dfx_eisa_table[] = {
> -        { "DEC3001", DEFEA_PROD_ID_1 },
> -        { "DEC3002", DEFEA_PROD_ID_2 },
> -        { "DEC3003", DEFEA_PROD_ID_3 },
> -        { "DEC3004", DEFEA_PROD_ID_4 },
> -        { }
> +	{ "DEC3001", DEFEA_PROD_ID_1 },
> +	{ "DEC3002", DEFEA_PROD_ID_2 },
> +	{ "DEC3003", DEFEA_PROD_ID_3 },
> +	{ "DEC3004", DEFEA_PROD_ID_4 },
> +	{ "" }

You haven't changed runtime at all.  :P (struct eisa_device_id)->sig[]
is an array, not a pointer.  There is no NULL dereference because an
array in the middle of another array can't be NULL.

regards,
dan carpenter


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

* Re: [PATCH] defxx: Fix a sentinel at the end of a 'eisa_device_id' structure
  2020-02-03  9:55 ` Dan Carpenter
@ 2020-02-03 10:20   ` Maciej W. Rozycki
  2020-02-03 17:38     ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: Maciej W. Rozycki @ 2020-02-03 10:20 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Christophe JAILLET, Ralf Baechle, David S. Miller, Andrew Morton,
	netdev, linux-kernel, kernel-janitors

On Mon, 3 Feb 2020, Dan Carpenter wrote:

> > diff --git a/drivers/net/fddi/defxx.c b/drivers/net/fddi/defxx.c
> > index 077c68498f04..7ef0c57f07c6 100644
> > --- a/drivers/net/fddi/defxx.c
> > +++ b/drivers/net/fddi/defxx.c
> > @@ -3768,11 +3768,11 @@ static void dfx_pci_unregister(struct pci_dev *pdev)
> >  
> >  #ifdef CONFIG_EISA
> >  static const struct eisa_device_id dfx_eisa_table[] = {
> > -        { "DEC3001", DEFEA_PROD_ID_1 },
> > -        { "DEC3002", DEFEA_PROD_ID_2 },
> > -        { "DEC3003", DEFEA_PROD_ID_3 },
> > -        { "DEC3004", DEFEA_PROD_ID_4 },
> > -        { }
> > +	{ "DEC3001", DEFEA_PROD_ID_1 },
> > +	{ "DEC3002", DEFEA_PROD_ID_2 },
> > +	{ "DEC3003", DEFEA_PROD_ID_3 },
> > +	{ "DEC3004", DEFEA_PROD_ID_4 },
> > +	{ "" }
> 
> You haven't changed runtime at all.  :P (struct eisa_device_id)->sig[]
> is an array, not a pointer.  There is no NULL dereference because an
> array in the middle of another array can't be NULL.

 Right, the code is good as it stands (I should have more faith in my past 
achievements ;) ).  Except for the whitespace issue, which I suppose might 
not be worth bothering to fix.  Thanks for your meticulousness!

  Maciej

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

* Re: [PATCH] defxx: Fix a sentinel at the end of a 'eisa_device_id' structure
  2020-02-03 10:20   ` Maciej W. Rozycki
@ 2020-02-03 17:38     ` Jakub Kicinski
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2020-02-03 17:38 UTC (permalink / raw)
  To: Maciej W. Rozycki
  Cc: Dan Carpenter, Christophe JAILLET, Ralf Baechle, David S. Miller,
	Andrew Morton, netdev, linux-kernel, kernel-janitors

On Mon, 3 Feb 2020 10:20:46 +0000 (GMT), Maciej W. Rozycki wrote:
>  Right, the code is good as it stands (I should have more faith in my past 
> achievements ;) ).  Except for the whitespace issue, which I suppose might 
> not be worth bothering to fix.  Thanks for your meticulousness!

For the white space clean up please resend after the merge window
(if you care), networking trees are only taking fixes fixes now :)

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

end of thread, other threads:[~2020-02-03 17:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-02 14:23 [PATCH] defxx: Fix a sentinel at the end of a 'eisa_device_id' structure Christophe JAILLET
2020-02-02 19:12 ` Maciej W. Rozycki
2020-02-03  9:55 ` Dan Carpenter
2020-02-03 10:20   ` Maciej W. Rozycki
2020-02-03 17:38     ` Jakub Kicinski

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).