]> git.notmuchmail.org Git - notmuch/blob - test/corpora/lkml/cur/1382298805.004688:2,
test: add 'lkml' corpus
[notmuch] / test / corpora / lkml / cur / 1382298805.004688:2,
1 From: =?ISO-8859-1?Q?Nicolas_de_Peslo=FCan?= 
2         <nicolas.2p.debian@gmail.com>
3 Subject: Re: [PATCH] core: dev: don't call BUG() on bad input
4 Date: Mon, 14 Feb 2011 14:01:44 +0100
5 Lines: 40
6 Message-ID: <4D5927B8.2070704@gmail.com>
7 References: <1297680967-11893-1-git-send-email-segoon@openwall.com> <4D591D04.4050000@gmail.com> <20110214122313.GA10062@albatros>
8 Mime-Version: 1.0
9 Content-Type: text/plain; charset=ISO-8859-1;
10         format=flowed
11 Content-Transfer-Encoding: QUOTED-PRINTABLE
12 Cc: linux-kernel@vger.kernel.org,
13         "David S. Miller" <davem@davemloft.net>,
14         Eric Dumazet <eric.dumazet@gmail.com>,
15         Tom Herbert <therbert@google.com>,
16         Changli Gao <xiaosuo@gmail.com>,
17         Jesse Gross <jesse@nicira.com>, netdev@vger.kernel.org
18 To: Vasiliy Kulikov <segoon@openwall.com>
19 X-From: netdev-owner@vger.kernel.org Mon Feb 14 14:02:23 2011
20 Return-path: <netdev-owner@vger.kernel.org>
21 Envelope-to: linux-netdev-2@lo.gmane.org
22 Received: from vger.kernel.org ([209.132.180.67])
23         by lo.gmane.org with esmtp (Exim 4.69)
24         (envelope-from <netdev-owner@vger.kernel.org>)
25         id 1Poy4M-0006df-J5
26         for linux-netdev-2@lo.gmane.org; Mon, 14 Feb 2011 14:02:22 +0100
27 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
28         id S1754233Ab1BNNBu convert rfc822-to-quoted-printable (ORCPT
29         <rfc822;linux-netdev-2@m.gmane.org>); Mon, 14 Feb 2011 08:01:50 -0500
30 Received: from mail-fx0-f46.google.com ([209.85.161.46]:54545 "EHLO
31         mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
32         with ESMTP id S1753647Ab1BNNBs (ORCPT
33         <rfc822;netdev@vger.kernel.org>); Mon, 14 Feb 2011 08:01:48 -0500
34 Received: by fxm20 with SMTP id 20so5178314fxm.19
35         for <multiple recipients>; Mon, 14 Feb 2011 05:01:47 -0800 (PST)
36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
37         d=gmail.com; s=gamma;
38         h=domainkey-signature:message-id:date:from:user-agent:mime-version:to
39          :cc:subject:references:in-reply-to:content-type
40          :content-transfer-encoding;
41         bh=AbxlHNh3L+hBj6Vij/+GRK5xyYUXmvKoB1QZLa2ZBj0=;
42         b=b/GQO7FpiFoh6WrR9d9qEW2Q1ZOK0YtYzl/fLoXZS49QbuYiuExhWkohPnHsdH/n7s
43          liu8crpx1n3Ajna/7GX1mHBP6V4lfhH+NyF0Rmw3w+fx154lFiY9dbyPX7H9MZNdW60a
44          8TmPRR356gmV+7bijgKwyMN1FRVMPNV0Zg0i8=
45 DomainKey-Signature: a=rsa-sha1; c=nofws;
46         d=gmail.com; s=gamma;
47         h=message-id:date:from:user-agent:mime-version:to:cc:subject
48          :references:in-reply-to:content-type:content-transfer-encoding;
49         b=C+hWB2Aof37xOLi8SWuN+D3QsDtf/f4yCxcLrNGhRYytyr/7CUmq/rS7PpgnfvBVBr
50          yaKwVZXs7QRxIWbPnzmV38e1K+eUwZ+dd9XuEFN1dnXd5KJVv4CjWr2N84NIHx/NvOBL
51          7QYK5+DuuRaccybcS4xWMNK8mujh9ebSBXTgM=
52 Received: by 10.223.87.1 with SMTP id u1mr4464553fal.112.1297688507260;
53         Mon, 14 Feb 2011 05:01:47 -0800 (PST)
54 Received: from [192.168.0.101] (eab95-4-88-175-177-37.fbx.proxad.net [88.175.177.37])
55         by mx.google.com with ESMTPS id y3sm1031898fai.38.2011.02.14.05.01.45
56         (version=SSLv3 cipher=OTHER);
57         Mon, 14 Feb 2011 05:01:46 -0800 (PST)
58 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20101226 Icedove/3.0.11
59 In-Reply-To: <20110214122313.GA10062@albatros>
60 Sender: netdev-owner@vger.kernel.org
61 Precedence: bulk
62 List-ID: <netdev.vger.kernel.org>
63 X-Mailing-List: netdev@vger.kernel.org
64 Archived-At: <http://permalink.gmane.org/gmane.linux.kernel/1099723>
65
66 Le 14/02/2011 13:23, Vasiliy Kulikov a =E9crit :
67 > Hi Nicolas,
68
69 Hi Vasiliy,
70
71 > On Mon, Feb 14, 2011 at 13:16 +0100, Nicolas de Peslo=FCan wrote:
72 >>> -   BUG_ON(strlen(name)>=3D sizeof(dev->name));
73 >>> +   if (strnlen(name, sizeof(dev->name))>=3D sizeof(dev->name)) {
74 >
75 > Ehh...  Space after ")" is needed :)
76
77 :-D
78
79 >> "size_t strnlen(const char *s, size_t maxlen) : The strnlen()
80 >> function returns strlen(s), if that is less than maxlen, or maxlen
81 >> if there is no '\0' character among the first maxlen characters
82 >> pointed to by s."
83 >>
84 >> How can strnlen(name, sizeof(dev->name)) be greater than sizeof(dev-=
85 >name)?
86 >>
87 >> Shouldn't it be "if (strnlen(name, sizeof(dev->name)) =3D=3D sizeof(=
88 dev->name))" instead?
89 >
90 > Not a big deal, but MO it's better to guard from everything that
91 > is not a good input by negating the check.  strnlen()<  sizeof() is O=
92 K,
93 > strnlen()>=3D sizeof() is bad.  Is "=3D=3D" more preferable for net/ =
94 coding style?
95
96 Agreed, both cannot cause any troubles. =3D=3D is supposed to be better=
97  from the API point of view, but=20
98  >=3D is probably more readable.
99
100         Nicolas.
101 --
102 To unsubscribe from this list: send the line "unsubscribe netdev" in
103 the body of a message to majordomo@vger.kernel.org
104 More majordomo info at  http://vger.kernel.org/majordomo-info.html
105
106
107