linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] pull-request: can-next 2023-02-08
@ 2023-02-08 21:00 Marc Kleine-Budde
  2023-02-08 21:00 ` [PATCH net-next 1/2] can: raw: use temp variable instead of rolling back config Marc Kleine-Budde
  2023-02-08 21:00 ` [PATCH net-next 2/2] can: bittiming: can_calc_bittiming(): add missing parameter to no-op function Marc Kleine-Budde
  0 siblings, 2 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2023-02-08 21:00 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, linux-can, kernel

Hello netdev-team,

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

The 1st patch is by Oliver Hartkopp and cleans up the CAN_RAW's
raw_setsockopt() for CAN_RAW_FD_FRAMES.

The 2nd patch is by me and fixes the compilation if
CONFIG_CAN_CALC_BITTIMING is disabled. (Problem introduced in last
pull request to next-next.)

regards,
Marc

---
The following changes since commit e6ebe6c12355538e9238e2051bd6757b12dbfe9c:

  Merge branch 'taprio-auto-qmaxsdu-new-tx' (2023-02-08 09:48:53 +0000)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git tags/linux-can-next-for-6.3-20230208

for you to fetch changes up to 65db3d8b5231bd430c12150258125aca155aea97:

  can: bittiming: can_calc_bittiming(): add missing parameter to no-op function (2023-02-08 21:53:24 +0100)

----------------------------------------------------------------
linux-can-next-for-6.3-20230208

----------------------------------------------------------------
Marc Kleine-Budde (1):
      can: bittiming: can_calc_bittiming(): add missing parameter to no-op function

Oliver Hartkopp (1):
      can: raw: use temp variable instead of rolling back config

 include/linux/can/bittiming.h |  2 +-
 net/can/raw.c                 | 11 ++++++-----
 2 files changed, 7 insertions(+), 6 deletions(-)



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

* [PATCH net-next 1/2] can: raw: use temp variable instead of rolling back config
  2023-02-08 21:00 [PATCH net-next 0/2] pull-request: can-next 2023-02-08 Marc Kleine-Budde
@ 2023-02-08 21:00 ` Marc Kleine-Budde
  2023-02-09  5:40   ` patchwork-bot+netdevbpf
  2023-02-08 21:00 ` [PATCH net-next 2/2] can: bittiming: can_calc_bittiming(): add missing parameter to no-op function Marc Kleine-Budde
  1 sibling, 1 reply; 4+ messages in thread
From: Marc Kleine-Budde @ 2023-02-08 21:00 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, linux-can, kernel, Oliver Hartkopp, Marc Kleine-Budde

From: Oliver Hartkopp <socketcan@hartkopp.net>

Introduce a temporary variable to check for an invalid configuration
attempt from user space. Before this patch the value was copied to
the real config variable and rolled back in the case of an error.

Suggested-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Link: https://lore.kernel.org/all/20230203090807.97100-1-socketcan@hartkopp.net
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 net/can/raw.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/net/can/raw.c b/net/can/raw.c
index ba86782ba8bb..f64469b98260 100644
--- a/net/can/raw.c
+++ b/net/can/raw.c
@@ -523,6 +523,7 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
 	struct can_filter sfilter;         /* single filter */
 	struct net_device *dev = NULL;
 	can_err_mask_t err_mask = 0;
+	int fd_frames;
 	int count = 0;
 	int err = 0;
 
@@ -664,17 +665,17 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
 		break;
 
 	case CAN_RAW_FD_FRAMES:
-		if (optlen != sizeof(ro->fd_frames))
+		if (optlen != sizeof(fd_frames))
 			return -EINVAL;
 
-		if (copy_from_sockptr(&ro->fd_frames, optval, optlen))
+		if (copy_from_sockptr(&fd_frames, optval, optlen))
 			return -EFAULT;
 
 		/* Enabling CAN XL includes CAN FD */
-		if (ro->xl_frames && !ro->fd_frames) {
-			ro->fd_frames = ro->xl_frames;
+		if (ro->xl_frames && !fd_frames)
 			return -EINVAL;
-		}
+
+		ro->fd_frames = fd_frames;
 		break;
 
 	case CAN_RAW_XL_FRAMES:

base-commit: e6ebe6c12355538e9238e2051bd6757b12dbfe9c
-- 
2.39.1



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

* [PATCH net-next 2/2] can: bittiming: can_calc_bittiming(): add missing parameter to no-op function
  2023-02-08 21:00 [PATCH net-next 0/2] pull-request: can-next 2023-02-08 Marc Kleine-Budde
  2023-02-08 21:00 ` [PATCH net-next 1/2] can: raw: use temp variable instead of rolling back config Marc Kleine-Budde
@ 2023-02-08 21:00 ` Marc Kleine-Budde
  1 sibling, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2023-02-08 21:00 UTC (permalink / raw)
  To: netdev
  Cc: davem, kuba, linux-can, kernel, Marc Kleine-Budde, kernel test robot

In commit 286c0e09e8e0 ("can: bittiming: can_changelink() pass extack
down callstack") a new parameter was added to can_calc_bittiming(),
however the static inline no-op (which is used if
CONFIG_CAN_CALC_BITTIMING is disabled) wasn't converted.

Add the new parameter to the static inline no-op of
can_calc_bittiming().

Fixes: 286c0e09e8e0 ("can: bittiming: can_changelink() pass extack down callstack")
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/20230207201734.2905618-1-mkl@pengutronix.de
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 include/linux/can/bittiming.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/can/bittiming.h b/include/linux/can/bittiming.h
index 6cb2ae308e3f..9b8a9c39614b 100644
--- a/include/linux/can/bittiming.h
+++ b/include/linux/can/bittiming.h
@@ -124,7 +124,7 @@ void can_calc_tdco(struct can_tdc *tdc, const struct can_tdc_const *tdc_const,
 #else /* !CONFIG_CAN_CALC_BITTIMING */
 static inline int
 can_calc_bittiming(const struct net_device *dev, struct can_bittiming *bt,
-		   const struct can_bittiming_const *btc)
+		   const struct can_bittiming_const *btc, struct netlink_ext_ack *extack)
 {
 	netdev_err(dev, "bit-timing calculation not available\n");
 	return -EINVAL;
-- 
2.39.1



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

* Re: [PATCH net-next 1/2] can: raw: use temp variable instead of rolling back config
  2023-02-08 21:00 ` [PATCH net-next 1/2] can: raw: use temp variable instead of rolling back config Marc Kleine-Budde
@ 2023-02-09  5:40   ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-02-09  5:40 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: netdev, davem, kuba, linux-can, kernel, socketcan

Hello:

This series was applied to netdev/net-next.git (master)
by Marc Kleine-Budde <mkl@pengutronix.de>:

On Wed,  8 Feb 2023 22:00:13 +0100 you wrote:
> From: Oliver Hartkopp <socketcan@hartkopp.net>
> 
> Introduce a temporary variable to check for an invalid configuration
> attempt from user space. Before this patch the value was copied to
> the real config variable and rolled back in the case of an error.
> 
> Suggested-by: Marc Kleine-Budde <mkl@pengutronix.de>
> Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
> Link: https://lore.kernel.org/all/20230203090807.97100-1-socketcan@hartkopp.net
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> 
> [...]

Here is the summary with links:
  - [net-next,1/2] can: raw: use temp variable instead of rolling back config
    https://git.kernel.org/netdev/net-next/c/f2f527d59596
  - [net-next,2/2] can: bittiming: can_calc_bittiming(): add missing parameter to no-op function
    https://git.kernel.org/netdev/net-next/c/65db3d8b5231

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:[~2023-02-09  5:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-08 21:00 [PATCH net-next 0/2] pull-request: can-next 2023-02-08 Marc Kleine-Budde
2023-02-08 21:00 ` [PATCH net-next 1/2] can: raw: use temp variable instead of rolling back config Marc Kleine-Budde
2023-02-09  5:40   ` patchwork-bot+netdevbpf
2023-02-08 21:00 ` [PATCH net-next 2/2] can: bittiming: can_calc_bittiming(): add missing parameter to no-op function Marc Kleine-Budde

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