diff options
author | Javier Martinez Canillas <javier@osg.samsung.com> | 2015-10-30 08:49:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-11-02 15:28:56 -0500 |
commit | d0cb48cd19ce1e249cd350aa67fbf63560292266 (patch) | |
tree | ea4d18959cfd57ddb405f3b3fa4ee804a8024cd7 | |
parent | 322cf7e3a4e89236ae386cb5668ae0d787d21136 (diff) |
net: encx24j600: Fix SPI id table definition
A driver's SPI id table is expected to be an array of struct spi_device_id
that ends with a zero-initialized sentinel entry. But this driver defines
the table as a single struct spi_device_id and sets .id_table to a pointer
to this struct.
But spi_match_id() has a loop that iterates while the struct spi_device_id
.name[0] is not NULL, so not having a sentinel can cause a NULL pointer
deference error.
This patch defines the SPI id table correctly as all other SPI drivers do.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/microchip/encx24j600.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/ethernet/microchip/encx24j600.c b/drivers/net/ethernet/microchip/encx24j600.c index bf08ce2baf8d..c2dafc1c53de 100644 --- a/drivers/net/ethernet/microchip/encx24j600.c +++ b/drivers/net/ethernet/microchip/encx24j600.c | |||
@@ -1094,8 +1094,9 @@ static int encx24j600_spi_remove(struct spi_device *spi) | |||
1094 | return 0; | 1094 | return 0; |
1095 | } | 1095 | } |
1096 | 1096 | ||
1097 | static const struct spi_device_id encx24j600_spi_id_table = { | 1097 | static const struct spi_device_id encx24j600_spi_id_table[] = { |
1098 | .name = "encx24j600" | 1098 | { .name = "encx24j600" }, |
1099 | { /* sentinel */ } | ||
1099 | }; | 1100 | }; |
1100 | 1101 | ||
1101 | static struct spi_driver encx24j600_spi_net_driver = { | 1102 | static struct spi_driver encx24j600_spi_net_driver = { |
@@ -1106,7 +1107,7 @@ static struct spi_driver encx24j600_spi_net_driver = { | |||
1106 | }, | 1107 | }, |
1107 | .probe = encx24j600_spi_probe, | 1108 | .probe = encx24j600_spi_probe, |
1108 | .remove = encx24j600_spi_remove, | 1109 | .remove = encx24j600_spi_remove, |
1109 | .id_table = &encx24j600_spi_id_table, | 1110 | .id_table = encx24j600_spi_id_table, |
1110 | }; | 1111 | }; |
1111 | 1112 | ||
1112 | static int __init encx24j600_init(void) | 1113 | static int __init encx24j600_init(void) |