Skip to content

Commit 5131a05

Browse files
committed
Merge tag 'linux-can-next-for-6.3-20230208' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next
Marc Kleine-Budde says: ==================== can-next 2023-02-08 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.) * tag 'linux-can-next-for-6.3-20230208' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next: can: bittiming: can_calc_bittiming(): add missing parameter to no-op function can: raw: use temp variable instead of rolling back config ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 9245b51 + 65db3d8 commit 5131a05

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

include/linux/can/bittiming.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void can_calc_tdco(struct can_tdc *tdc, const struct can_tdc_const *tdc_const,
124124
#else /* !CONFIG_CAN_CALC_BITTIMING */
125125
static inline int
126126
can_calc_bittiming(const struct net_device *dev, struct can_bittiming *bt,
127-
const struct can_bittiming_const *btc)
127+
const struct can_bittiming_const *btc, struct netlink_ext_ack *extack)
128128
{
129129
netdev_err(dev, "bit-timing calculation not available\n");
130130
return -EINVAL;

net/can/raw.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,7 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
523523
struct can_filter sfilter; /* single filter */
524524
struct net_device *dev = NULL;
525525
can_err_mask_t err_mask = 0;
526+
int fd_frames;
526527
int count = 0;
527528
int err = 0;
528529

@@ -664,17 +665,17 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
664665
break;
665666

666667
case CAN_RAW_FD_FRAMES:
667-
if (optlen != sizeof(ro->fd_frames))
668+
if (optlen != sizeof(fd_frames))
668669
return -EINVAL;
669670

670-
if (copy_from_sockptr(&ro->fd_frames, optval, optlen))
671+
if (copy_from_sockptr(&fd_frames, optval, optlen))
671672
return -EFAULT;
672673

673674
/* Enabling CAN XL includes CAN FD */
674-
if (ro->xl_frames && !ro->fd_frames) {
675-
ro->fd_frames = ro->xl_frames;
675+
if (ro->xl_frames && !fd_frames)
676676
return -EINVAL;
677-
}
677+
678+
ro->fd_frames = fd_frames;
678679
break;
679680

680681
case CAN_RAW_XL_FRAMES:

0 commit comments

Comments
 (0)