From: Gustavo Padovan <gustavo@padovan.org>
To: Andre Guedes <andre.guedes@openbossa.org>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 2/3] Bluetooth: Check MTU value in l2cap_sock_setsockopt_old
Date: Thu, 31 May 2012 10:42:55 -0300 [thread overview]
Message-ID: <20120531134255.GP18069@joana> (raw)
In-Reply-To: <1338401329-31429-2-git-send-email-andre.guedes@openbossa.org>
Hi Andre,
* Andre Guedes <andre.guedes@openbossa.org> [2012-05-30 15:08:48 -0300]:
> If user tries to set an invalid MTU value, l2cap_sock_setsockopt_old
> should return -EINVAL.
>
> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
> ---
> net/bluetooth/l2cap_sock.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
> diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
> index d856cc8..a7ac747 100644
> --- a/net/bluetooth/l2cap_sock.c
> +++ b/net/bluetooth/l2cap_sock.c
> @@ -445,6 +445,22 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, ch
> return err;
> }
>
> +static bool is_valid_mtu(struct l2cap_chan *chan, u16 mtu)
I prefer if we call this l2cap_valid_mtu()
> +{
> + switch (chan->scid) {
> + case L2CAP_CID_LE_DATA:
> + if (mtu < L2CAP_LE_DEFAULT_MTU)
> + return 0;
If you want to return bool you might want to return false here.
> + break;
> +
> + default:
> + if (mtu < L2CAP_DEFAULT_MIN_MTU)
> + return 0;
> + }
> +
> + return 1;
and true here.
Gustavo
next prev parent reply other threads:[~2012-05-31 13:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-30 18:08 [PATCH 1/3] Bluetooth: Change default MTU for L2CAP ATT channel Andre Guedes
2012-05-30 18:08 ` [PATCH 2/3] Bluetooth: Check MTU value in l2cap_sock_setsockopt_old Andre Guedes
2012-05-31 13:42 ` Gustavo Padovan [this message]
2012-05-31 19:08 ` Andre Guedes
2012-05-30 18:08 ` [PATCH 3/3] Bluetooth: Rename L2CAP_LE_DEFAULT_MTU Andre Guedes
2012-05-31 13:33 ` [PATCH 1/3] Bluetooth: Change default MTU for L2CAP ATT channel Gustavo Padovan
2012-05-31 19:08 ` Andre Guedes
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=20120531134255.GP18069@joana \
--to=gustavo@padovan.org \
--cc=andre.guedes@openbossa.org \
--cc=linux-bluetooth@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