FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor


 
 
LinkBack Thread Tools
 
Old 03-21-2012, 01:17 PM
David Teigland
 
Default never used?

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
 

Thread Tools




All times are GMT. The time now is 09:23 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org