From: Hal Rosenstock <hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
To: "Weiny, Ira" <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>,
"linux-rdma
(linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org)"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Dan Ben-Yosef <danby-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH infiniband-diags] libibnetdisc/ibnetdisc.c: fix insert of invalid lid 0xFFFF into lid_port hash_table
Date: Mon, 13 Jan 2014 08:03:40 -0500 [thread overview]
Message-ID: <52D3E42C.4030201@dev.mellanox.co.il> (raw)
In-Reply-To: <2807E5FD2F6FDA4886F6618EAC48510E04A93D22-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
On 1/12/2014 10:34 AM, Weiny, Ira wrote:
> Good catch some comments below.
>
>> -----Original Message-----
>> From: Hal Rosenstock [mailto:hal-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org]
>> Sent: Monday, December 30, 2013 6:51 AM
>> To: Ira Weiny
>> Cc: linux-rdma (linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org); Dan Ben-Yosef
>> Subject: [PATCH infiniband-diags] libibnetdisc/ibnetdisc.c: fix insert of invalid
>> lid 0xFFFF into lid_port hash_table
>>
>> From: Dan Ben Yosef <danby-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>>
>> Signed-off-by: Dan Ben Yosef <danby-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>> ---
>> libibnetdisc/src/ibnetdisc.c | 12 +++++++-----
>> 1 files changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/libibnetdisc/src/ibnetdisc.c b/libibnetdisc/src/ibnetdisc.c index
>> 9d120dd..121fe35 100644
>> --- a/libibnetdisc/src/ibnetdisc.c
>> +++ b/libibnetdisc/src/ibnetdisc.c
>> @@ -647,11 +647,13 @@ void add_to_portlid_hash(ibnd_port_t * port,
>> GHashTable *htable)
>> uint16_t base_lid = port->base_lid;
>> uint16_t lid_mask = ((1 << port->lmc) -1);
>> uint16_t lid = 0;
>> -
>> - /* We add the port for all lids
>> - * so it is easier to find any "random" lid specified */
>> - for (lid = base_lid; lid <= (base_lid + lid_mask); lid++) {
>> - g_hash_table_insert(htable, GINT_TO_POINTER(lid), port);
>> + /* 0 < valid lid <= 0xbfff */
>> + if (base_lid > 0 && base_lid <= 0xbfff) {
>
> Shouldn't we check the "max LID" (based on LMC) here to make sure they are all vaild?
I guess it depends how strict we want to be for this check and whether
it's consistent with other such checks in the library.
I think that the check of the base LID based on the LMC should be a
separate additional check. Is this currently done anywhere else in the
library ?
-- Hal
>
> Ira
>
>> + /* We add the port for all lids
>> + * so it is easier to find any "random" lid specified */
>> + for (lid = base_lid; lid <= (base_lid + lid_mask); lid++) {
>> + g_hash_table_insert(htable, GINT_TO_POINTER(lid),
>> port);
>> + }
>> }
>> }
>>
>> --
>> 1.7.8.2
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-01-13 13:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-30 14:50 [PATCH infiniband-diags] libibnetdisc/ibnetdisc.c: fix insert of invalid lid 0xFFFF into lid_port hash_table Hal Rosenstock
[not found] ` <52C18853.8080107-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2014-01-12 15:34 ` Weiny, Ira
[not found] ` <2807E5FD2F6FDA4886F6618EAC48510E04A93D22-8k97q/ur5Z2krb+BlOpmy7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2014-01-13 13:03 ` Hal Rosenstock [this message]
[not found] ` <52D3E42C.4030201-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2014-01-25 1:22 ` Weiny, Ira
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=52D3E42C.4030201@dev.mellanox.co.il \
--to=hal-ldsdmyg8hgv8yrgs2mwiifqbs+8scbdb@public.gmane.org \
--cc=danby-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=weiny2-i2BcT+NCU+M@public.gmane.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