Linux CAN drivers development
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: linux-can@vger.kernel.org
Cc: Marc Kleine-Budde <mkl@pengutronix.de>,
	netdev@vger.kernel.org, Simon Horman <horms@kernel.org>
Subject: Re: [PATCH] can: raw: fix getsockopt() for new CAN_RAW_XL_VCID_OPTS
Date: Mon, 19 Feb 2024 21:23:00 +0100	[thread overview]
Message-ID: <a41ed65c-a916-424d-b4e7-9db65c015b50@hartkopp.net> (raw)
In-Reply-To: <20240219200021.12113-1-socketcan@hartkopp.net>

Sorry. Of course it is a [PATCH net-next] where the referenced commit 
has been applied.

Best regards,
Oliver

On 2024-02-19 21:00, Oliver Hartkopp wrote:
> The code for the CAN_RAW_XL_VCID_OPTS getsockopt() was incompletely adopted
> from the CAN_RAW_FILTER getsockopt().
> 
> Add the missing put_user() and return statements.
> 
> Flagged by Smatch.
> Fixes: c83c22ec1493 ("can: canxl: add virtual CAN network identifier support")
> Reported-by: Simon Horman <horms@kernel.org>
> Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
> ---
>   net/can/raw.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/can/raw.c b/net/can/raw.c
> index cb8e6f788af8..897ffc17d850 100644
> --- a/net/can/raw.c
> +++ b/net/can/raw.c
> @@ -833,11 +833,13 @@ static int raw_getsockopt(struct socket *sock, int level, int optname,
>   			if (len > sizeof(ro->raw_vcid_opts))
>   				len = sizeof(ro->raw_vcid_opts);
>   			if (copy_to_user(optval, &ro->raw_vcid_opts, len))
>   				err = -EFAULT;
>   		}
> -		break;
> +		if (!err)
> +			err = put_user(len, optlen);
> +		return err;
>   
>   	case CAN_RAW_JOIN_FILTERS:
>   		if (len > sizeof(int))
>   			len = sizeof(int);
>   		val = &ro->join_filters;

  reply	other threads:[~2024-02-19 20:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19 20:00 [PATCH] can: raw: fix getsockopt() for new CAN_RAW_XL_VCID_OPTS Oliver Hartkopp
2024-02-19 20:23 ` Oliver Hartkopp [this message]
2024-02-20  7:26 ` Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a41ed65c-a916-424d-b4e7-9db65c015b50@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=horms@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox