From: Max Staudt <max@enpas.org>
To: Vincent Mailhol <mailhol.vincent@wanadoo.fr>,
Dan Carpenter <dan.carpenter@linaro.org>,
Marc Kleine-Budde <mkl@pengutronix.de>
Cc: linux-can@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] can: can327: Clean up payload encoding in can327_handle_prompt()
Date: Thu, 21 Nov 2024 00:59:28 +0900 [thread overview]
Message-ID: <f6baf8dd-4652-450e-a08b-157a806d4459@enpas.org> (raw)
In-Reply-To: <4621cc30-92d7-4b07-8058-a1d677f28135@enpas.org>
On 11/20/24 02:15, Max Staudt wrote:
> A bit off-topic, but since CAN_RAW came up: Why does CAN_RAW even
> sanitise anything at all, instead of relying on checks on later layers?
> It seems like quite a few checks are duplicated. And all the while it's
> possible for userspace to do weird stuff like seemingly enabling CAN FD
> on the socket via setsockopt() CAN_RAW_FD_FRAMES, but that's only
> flipping a bit on the CAN_RAW socket, yet changes nothing underneath. It
> was quite confusing to read. I suppose the explanation is "legacy"?
Answering my own question here:
CAN_RAW_FD_FRAMES modifies what frames are allowed to pass through the
CAN_RAW socket towards userspace. This way, simple software handling
only CAN 2.0 frames may assume that reading anything other than CAN_MTU
bytes from the socket is an error. This keeps the code simple, and old
programs have to be written this way, because there is no way for them
to guess what not yet implemented CAN versions will look like.
So, this option makes a lot more sense to me now, sorry for the extra
noise :)
Max
prev parent reply other threads:[~2024-11-20 15:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-19 0:38 Max Staudt
2024-11-19 7:41 ` Vincent Mailhol
2024-11-19 17:15 ` Max Staudt
2024-11-20 15:59 ` Max Staudt [this message]
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=f6baf8dd-4652-450e-a08b-157a806d4459@enpas.org \
--to=max@enpas.org \
--cc=dan.carpenter@linaro.org \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mailhol.vincent@wanadoo.fr \
--cc=mkl@pengutronix.de \
/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
all inboxes | Powered by JetHome®