From: David Teigland <teigland@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] last element of dlm_local_addr[] never used?
Date: Wed, 21 Mar 2012 10:17:29 -0400 [thread overview]
Message-ID: <20120321141729.GB32165@redhat.com> (raw)
In-Reply-To: <20120321092435.GB7848@mwanda>
On Wed, Mar 21, 2012 at 12:24:35PM +0300, Dan Carpenter wrote:
> In fs/dlm/lowcomms.c we declare the dlm_local_addr[] array like
> this:
> static struct sockaddr_storage *dlm_local_addr[DLM_MAX_ADDR_COUNT];
>
> But it looks like the last element of the array is never used:
>
> 1072 /* Get local addresses */
> 1073 static void init_local(void)
> 1074 {
> 1075 struct sockaddr_storage sas, *addr;
> 1076 int i;
> 1077
> 1078 dlm_local_count = 0;
> 1079 for (i = 0; i < DLM_MAX_ADDR_COUNT - 1; i++) {
> ^^^^^^^^^^^^^^^^^^^^^^
> 1080 if (dlm_our_addr(&sas, i))
> 1081 break;
> 1082
> 1083 addr = kmalloc(sizeof(*addr), GFP_NOFS);
> 1084 if (!addr)
> 1085 break;
> 1086 memcpy(addr, &sas, sizeof(*addr));
> 1087 dlm_local_addr[dlm_local_count++] = addr;
> 1088 }
> 1089 }
>
> There isn't anywhere else we use it either. It's not harmful to
> leave the last element unused but I wondered if it was intentional.
config.c properly supports the max, so we should just remove the -1.
I'll add a patch.
Thanks,
Dave
parent reply other threads:[~2012-03-21 14:17 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20120321092435.GB7848@mwanda>]
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=20120321141729.GB32165@redhat.com \
--to=teigland@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).