* [RFC] tls: length check correct in do_tls_getsockopt_tx()?
@ 2017-07-05 7:10 Matthias Rosenfelder
2017-07-05 10:17 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Matthias Rosenfelder @ 2017-07-05 7:10 UTC (permalink / raw)
To: netdev; +Cc: davem, dan.carpenter, davejwatson
Hi,
In do_tls_getsockopt_tx():
if (len == sizeof(crypto_info)) {
should be
if (len == sizeof(*crypto_info)) {
as crypto_info is of pointer type. Or am I missing something?
btw: I am not very familiar with sockets. So I am wondering
what is the use of this functionality? Why copy only the header
to userspace?
Thanks.
Best Regards,
Matthias
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [RFC] tls: length check correct in do_tls_getsockopt_tx()?
2017-07-05 7:10 [RFC] tls: length check correct in do_tls_getsockopt_tx()? Matthias Rosenfelder
@ 2017-07-05 10:17 ` Dan Carpenter
2017-07-05 11:07 ` Julia Lawall
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2017-07-05 10:17 UTC (permalink / raw)
To: Matthias Rosenfelder; +Cc: netdev, davem, davejwatson, Julia Lawall
On Wed, Jul 05, 2017 at 03:10:53AM -0400, Matthias Rosenfelder wrote:
> Hi,
>
> In do_tls_getsockopt_tx():
>
> if (len == sizeof(crypto_info)) {
>
> should be
>
> if (len == sizeof(*crypto_info)) {
>
> as crypto_info is of pointer type. Or am I missing something?
No, you're right. It should be "sizeof(*crypto_info)".
It's hard for Smatch to catch these sorts of bugs because Sparse
sometimes just gives Smatch a number literal instead of a sizeof()
expression. I think Coccinelle can catch these kinds of bugs?
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [RFC] tls: length check correct in do_tls_getsockopt_tx()?
2017-07-05 10:17 ` Dan Carpenter
@ 2017-07-05 11:07 ` Julia Lawall
0 siblings, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2017-07-05 11:07 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Matthias Rosenfelder, netdev, davem, davejwatson
On Wed, 5 Jul 2017, Dan Carpenter wrote:
> On Wed, Jul 05, 2017 at 03:10:53AM -0400, Matthias Rosenfelder wrote:
> > Hi,
> >
> > In do_tls_getsockopt_tx():
> >
> > if (len == sizeof(crypto_info)) {
> >
> > should be
> >
> > if (len == sizeof(*crypto_info)) {
> >
> > as crypto_info is of pointer type. Or am I missing something?
>
> No, you're right. It should be "sizeof(*crypto_info)".
>
> It's hard for Smatch to catch these sorts of bugs because Sparse
> sometimes just gives Smatch a number literal instead of a sizeof()
> expression. I think Coccinelle can catch these kinds of bugs?
Currently, I think the Coccinelle rules are only looking for things like x
= f(...,sizeof(x),...)
julia
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-07-05 11:07 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-05 7:10 [RFC] tls: length check correct in do_tls_getsockopt_tx()? Matthias Rosenfelder
2017-07-05 10:17 ` Dan Carpenter
2017-07-05 11:07 ` Julia Lawall
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox