Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91b165c0 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds
Browse files

[PATCH] uml: Use ARRAY_SIZE more assiduously



There were a bunch of missed ARRAY_SIZE opportunities.

Also, some formatting fixes in the affected areas of code.

Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 13c06be3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -544,7 +544,7 @@ static struct chan *parse_chan(struct line *line, char *str, int device,

	ops = NULL;
	data = NULL;
	for(i = 0; i < sizeof(chan_table)/sizeof(chan_table[0]); i++){
	for(i = 0; i < ARRAY_SIZE(chan_table); i++){
		entry = &chan_table[i];
		if(!strncmp(str, entry->key, strlen(entry->key))){
			ops = entry->ops;
+1 −1
Original line number Diff line number Diff line
@@ -497,7 +497,7 @@ static void mconsole_get_config(int (*get_config)(char *, char *, int,
	}

	error = NULL;
	size = sizeof(default_buf)/sizeof(default_buf[0]);
	size = ARRAY_SIZE(default_buf);
	buf = default_buf;

	while(1){
+4 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
#include "user.h"
#include "mconsole.h"
#include "umid.h"
#include "user_util.h"

static struct mconsole_command commands[] = {
	/* With uts namespaces, uts information becomes process-specific, so
@@ -65,14 +66,14 @@ static struct mconsole_command *mconsole_parse(struct mc_request *req)
	struct mconsole_command *cmd;
	int i;

	for(i=0;i<sizeof(commands)/sizeof(commands[0]);i++){
	for(i = 0; i < ARRAY_SIZE(commands); i++){
		cmd = &commands[i];
		if(!strncmp(req->request.data, cmd->command, 
			    strlen(cmd->command))){
			return(cmd);
			return cmd;
		}
	}
	return(NULL);
	return NULL;
}

#define MIN(a,b) ((a)<(b) ? (a):(b))
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ int pcap_setup(char *str, char **mac_out, void *data)
	if(host_if != NULL)
		init->host_if = host_if;

	for(i = 0; i < sizeof(options)/sizeof(options[0]); i++){
	for(i = 0; i < ARRAY_SIZE(options); i++){
		if(options[i] == NULL)
			continue;
		if(!strcmp(options[i], "promisc"))
+2 −1
Original line number Diff line number Diff line
@@ -223,8 +223,9 @@ void paging_init(void)

	empty_zero_page = (unsigned long *) alloc_bootmem_low_pages(PAGE_SIZE);
	empty_bad_page = (unsigned long *) alloc_bootmem_low_pages(PAGE_SIZE);
	for(i=0;i<sizeof(zones_size)/sizeof(zones_size[0]);i++) 
	for(i = 0; i < ARRAY_SIZE(zones_size); i++)
		zones_size[i] = 0;

	zones_size[ZONE_DMA] = (end_iomem >> PAGE_SHIFT) - (uml_physmem >> PAGE_SHIFT);
#ifdef CONFIG_HIGHMEM
	zones_size[ZONE_HIGHMEM] = highmem >> PAGE_SHIFT;
Loading