[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6122C479-ADD9-43A8-8EB6-CF518F97F64C@kernel.org>
Date: Sun, 17 Sep 2023 19:00:58 -0700
From: Kees Cook <kees@...nel.org>
To: Xiubo Li <xiubli@...hat.com>, Kees Cook <keescook@...omium.org>,
Ilya Dryomov <idryomov@...il.com>
CC: Jeff Layton <jlayton@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, ceph-devel@...r.kernel.org,
netdev@...r.kernel.org, Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev, linux-hardening@...r.kernel.org
Subject: Re: [PATCH] ceph: Annotate struct ceph_monmap with __counted_by
On September 17, 2023 5:25:10 PM PDT, Xiubo Li <xiubli@...hat.com> wrote:
>
>On 9/16/23 04:15, Kees Cook wrote:
> > [...]
>> Additionally, since the element count member must be set before accessing
>> the annotated flexible array member, move its initialization earlier.
>>
>> [...]
>> diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
>> index faabad6603db..f263f7e91a21 100644
>> --- a/net/ceph/mon_client.c
>> +++ b/net/ceph/mon_client.c
>> @@ -1136,6 +1136,7 @@ static int build_initial_monmap(struct ceph_mon_client *monc)
>> GFP_KERNEL);
>> if (!monc->monmap)
>> return -ENOMEM;
>> + monc->monmap->num_mon = num_mon;
>> for (i = 0; i < num_mon; i++) {
>> struct ceph_entity_inst *inst = &monc->monmap->mon_inst[i];
>> @@ -1147,7 +1148,6 @@ static int build_initial_monmap(struct ceph_mon_client *monc)
>> inst->name.type = CEPH_ENTITY_TYPE_MON;
>> inst->name.num = cpu_to_le64(i);
>> }
>> - monc->monmap->num_mon = num_mon;
>
>BTW, is this change related ?
Yes, this is needed so that the __counted_by size is set before accessing the flexible array.
>
>> return 0;
>> }
>>
>
>Else LGTM.
>
>Reviewed-by: Xiubo Li <xiubli@...hat.com>
Thanks!
--
Kees Cook
Powered by blists - more mailing lists