linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pull-request: can 2021-09-07
@ 2021-09-07  6:52 Marc Kleine-Budde
  2021-09-07  6:52 ` [PATCH net 1/2] can: rcar_canfd: add __maybe_unused annotation to silence warning Marc Kleine-Budde
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2021-09-07  6:52 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, linux-can, kernel

Hello Jakub, hello David,

this is a pull request of 2 patches for net/master.

The first patch is by my and silences a warning in the rcar_canfd
driver, if it's compiled with CONFIG_OF disabled.

Tong Zhang's patch fixes a null-ptr-deref in the c_can driver's
ethtool drvinfo function, for non platform bus based c_can devices.

regards,
Marc

---

The following changes since commit b539c44df067ac116ec1b58b956efda51b6a7fc1:

  net: wwan: iosm: Unify IO accessors used in the driver (2021-09-06 16:45:30 +0100)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can.git tags/linux-can-fixes-for-5.15-20210907

for you to fetch changes up to 644d0a5bcc3361170d84fb8d0b13943c354119db:

  can: c_can: fix null-ptr-deref on ioctl() (2021-09-07 08:46:58 +0200)

----------------------------------------------------------------
linux-can-fixes-for-5.15-20210907

----------------------------------------------------------------
Marc Kleine-Budde (1):
      can: rcar_canfd: add __maybe_unused annotation to silence warning

Tong Zhang (1):
      can: c_can: fix null-ptr-deref on ioctl()

 drivers/net/can/c_can/c_can_ethtool.c | 4 +---
 drivers/net/can/rcar/rcar_canfd.c     | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)



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

* [PATCH net 1/2] can: rcar_canfd: add __maybe_unused annotation to silence warning
  2021-09-07  6:52 pull-request: can 2021-09-07 Marc Kleine-Budde
@ 2021-09-07  6:52 ` Marc Kleine-Budde
  2021-09-07  6:52 ` [PATCH net 2/2] can: c_can: fix null-ptr-deref on ioctl() Marc Kleine-Budde
  2021-09-07  9:20 ` pull-request: can 2021-09-07 patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2021-09-07  6:52 UTC (permalink / raw)
  To: netdev
  Cc: davem, kuba, linux-can, kernel, Marc Kleine-Budde,
	linux-renesas-soc, Cai Huoqing, kernel test robot

Since commit

| dd3bd23eb438 ("can: rcar_canfd: Add Renesas R-Car CAN FD driver")

the rcar_canfd driver can be compile tested on all architectures. On
non OF enabled archs, or archs where OF is optional (and disabled in
the .config) the compilation throws the following warning:

| drivers/net/can/rcar/rcar_canfd.c:2020:34: warning: unused variable 'rcar_canfd_of_table' [-Wunused-const-variable]
| static const struct of_device_id rcar_canfd_of_table[] = {
|                                  ^

This patch fixes the warning by marking the variable
rcar_canfd_of_table as __maybe_unused.

Fixes: ac4224087312 ("can: rcar: Kconfig: Add helper dependency on COMPILE_TEST")
Fixes: dd3bd23eb438 ("can: rcar_canfd: Add Renesas R-Car CAN FD driver")
Link: https://lore.kernel.org/all/20210907064537.1054268-1-mkl@pengutronix.de
Cc: linux-renesas-soc@vger.kernel.org
Cc: Cai Huoqing <caihuoqing@baidu.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/rcar/rcar_canfd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index c47988d3674e..ff9d0f5ae0dd 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -2017,7 +2017,7 @@ static int __maybe_unused rcar_canfd_resume(struct device *dev)
 static SIMPLE_DEV_PM_OPS(rcar_canfd_pm_ops, rcar_canfd_suspend,
 			 rcar_canfd_resume);
 
-static const struct of_device_id rcar_canfd_of_table[] = {
+static const __maybe_unused struct of_device_id rcar_canfd_of_table[] = {
 	{ .compatible = "renesas,rcar-gen3-canfd", .data = (void *)RENESAS_RCAR_GEN3 },
 	{ .compatible = "renesas,rzg2l-canfd", .data = (void *)RENESAS_RZG2L },
 	{ }

base-commit: b539c44df067ac116ec1b58b956efda51b6a7fc1
-- 
2.33.0



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

* [PATCH net 2/2] can: c_can: fix null-ptr-deref on ioctl()
  2021-09-07  6:52 pull-request: can 2021-09-07 Marc Kleine-Budde
  2021-09-07  6:52 ` [PATCH net 1/2] can: rcar_canfd: add __maybe_unused annotation to silence warning Marc Kleine-Budde
@ 2021-09-07  6:52 ` Marc Kleine-Budde
  2021-09-07  9:20 ` pull-request: can 2021-09-07 patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2021-09-07  6:52 UTC (permalink / raw)
  To: netdev
  Cc: davem, kuba, linux-can, kernel, Tong Zhang, stable, Marc Kleine-Budde

From: Tong Zhang <ztong0001@gmail.com>

The pdev maybe not a platform device, e.g. c_can_pci device, in this
case, calling to_platform_device() would not make sense. Also, per the
comment in drivers/net/can/c_can/c_can_ethtool.c, @bus_info should
match dev_name() string, so I am replacing this with dev_name() to fix
this issue.

[    1.458583] BUG: unable to handle page fault for address: 0000000100000000
[    1.460921] RIP: 0010:strnlen+0x1a/0x30
[    1.466336]  ? c_can_get_drvinfo+0x65/0xb0 [c_can]
[    1.466597]  ethtool_get_drvinfo+0xae/0x360
[    1.466826]  dev_ethtool+0x10f8/0x2970
[    1.467880]  sock_ioctl+0xef/0x300

Fixes: 2722ac986e93 ("can: c_can: add ethtool support")
Link: https://lore.kernel.org/r/20210906233704.1162666-1-ztong0001@gmail.com
Cc: stable@vger.kernel.org # 5.14+
Signed-off-by: Tong Zhang <ztong0001@gmail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/c_can/c_can_ethtool.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/can/c_can/c_can_ethtool.c b/drivers/net/can/c_can/c_can_ethtool.c
index cd5f07fca2a5..377c7d2e7612 100644
--- a/drivers/net/can/c_can/c_can_ethtool.c
+++ b/drivers/net/can/c_can/c_can_ethtool.c
@@ -15,10 +15,8 @@ static void c_can_get_drvinfo(struct net_device *netdev,
 			      struct ethtool_drvinfo *info)
 {
 	struct c_can_priv *priv = netdev_priv(netdev);
-	struct platform_device *pdev = to_platform_device(priv->device);
-
 	strscpy(info->driver, "c_can", sizeof(info->driver));
-	strscpy(info->bus_info, pdev->name, sizeof(info->bus_info));
+	strscpy(info->bus_info, dev_name(priv->device), sizeof(info->bus_info));
 }
 
 static void c_can_get_ringparam(struct net_device *netdev,
-- 
2.33.0



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

* Re: pull-request: can 2021-09-07
  2021-09-07  6:52 pull-request: can 2021-09-07 Marc Kleine-Budde
  2021-09-07  6:52 ` [PATCH net 1/2] can: rcar_canfd: add __maybe_unused annotation to silence warning Marc Kleine-Budde
  2021-09-07  6:52 ` [PATCH net 2/2] can: c_can: fix null-ptr-deref on ioctl() Marc Kleine-Budde
@ 2021-09-07  9:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-09-07  9:20 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: netdev, davem, kuba, linux-can, kernel

Hello:

This pull request was applied to netdev/net.git (refs/heads/master):

On Tue,  7 Sep 2021 08:52:50 +0200 you wrote:
> Hello Jakub, hello David,
> 
> this is a pull request of 2 patches for net/master.
> 
> The first patch is by my and silences a warning in the rcar_canfd
> driver, if it's compiled with CONFIG_OF disabled.
> 
> [...]

Here is the summary with links:
  - pull-request: can 2021-09-07
    https://git.kernel.org/netdev/net/c/1c990729e198
  - [net,2/2] can: c_can: fix null-ptr-deref on ioctl()
    https://git.kernel.org/netdev/net/c/644d0a5bcc33

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-09-07  9:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07  6:52 pull-request: can 2021-09-07 Marc Kleine-Budde
2021-09-07  6:52 ` [PATCH net 1/2] can: rcar_canfd: add __maybe_unused annotation to silence warning Marc Kleine-Budde
2021-09-07  6:52 ` [PATCH net 2/2] can: c_can: fix null-ptr-deref on ioctl() Marc Kleine-Budde
2021-09-07  9:20 ` pull-request: can 2021-09-07 patchwork-bot+netdevbpf

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