Commit 68286bb8 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] memcpy/memset fixes

Fix some places which were doing

	memcpy(to, from, sizeof(to));
and
	memset(to, 0, sizeof(to));

Found by the Stanford checker.
parent 9200f0ce
......@@ -3165,7 +3165,7 @@ static void ohci_init_config_rom(struct ti_ohci *ohci)
struct config_rom_ptr cr;
memset(&cr, 0, sizeof(cr));
memset(ohci->csr_config_rom_cpu, 0, sizeof (ohci->csr_config_rom_cpu));
memset(ohci->csr_config_rom_cpu, 0, sizeof(*ohci->csr_config_rom_cpu));
cr.data = ohci->csr_config_rom_cpu;
......
......@@ -116,7 +116,7 @@ diva_strace_library_interface_t* DivaSTraceLibraryCreateInstance (int Adapter,
}
pmem += sizeof(*pLib);
memset (pLib, 0x00, sizeof(pLib));
memset(pLib, 0x00, sizeof(*pLib));
pLib->Adapter = Adapter;
......
......@@ -1071,7 +1071,7 @@ static void disable_comm (sdla_t *card)
card->tty=NULL;
tty_card_map[card->tty_minor]=NULL;
state = &rs_table[card->tty_minor];
memset(state,0,sizeof(state));
memset(state, 0, sizeof(*state));
}
return;
}
......
......@@ -4838,7 +4838,7 @@ static int airo_get_range(struct net_device *dev,
readCapabilityRid(local, &cap_rid);
dwrq->length = sizeof(struct iw_range);
memset(range, 0, sizeof(range));
memset(range, 0, sizeof(*range));
range->min_nwid = 0x0000;
range->max_nwid = 0x0000;
range->num_channels = 14;
......
......@@ -4664,7 +4664,7 @@ mega_is_bios_enabled(adapter_t *adapter)
mbox = (mbox_t *)raw_mbox;
memset(mbox, 0, sizeof(mbox));
memset(mbox, 0, sizeof(*mbox));
memset((void *)adapter->mega_buffer, 0, MEGA_BUFFER_SIZE);
......@@ -4697,7 +4697,7 @@ mega_enum_raid_scsi(adapter_t *adapter)
mbox = (mbox_t *)raw_mbox;
memset(mbox, 0, sizeof(mbox));
memset(mbox, 0, sizeof(*mbox));
/*
* issue command to find out what channels are raid/scsi
......@@ -4818,7 +4818,7 @@ mega_support_random_del(adapter_t *adapter)
mbox = (mbox_t *)raw_mbox;
memset(mbox, 0, sizeof(mbox));
memset(mbox, 0, sizeof(*mbox));
/*
* issue command
......@@ -4847,7 +4847,7 @@ mega_support_ext_cdb(adapter_t *adapter)
mbox = (mbox_t *)raw_mbox;
memset(mbox, 0, sizeof (mbox));
memset(mbox, 0, sizeof(*mbox));
/*
* issue command to find out if controller supports extended CDBs.
*/
......
......@@ -148,7 +148,7 @@ MD5Final(unsigned char digest[16], struct MD5Context *ctx)
MD5Transform(ctx->buf, (__u32 *) ctx->in);
byteReverse((unsigned char *) ctx->buf, 4);
memmove(digest, ctx->buf, 16);
memset(ctx, 0, sizeof (ctx)); /* In case it's sensitive */
memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
}
/* The four core functions - F1 is optimized somewhat */
......
......@@ -110,7 +110,8 @@ static int nr_add_node(ax25_address *nr, const char *mnemonic, ax25_address *ax2
kfree(nr_neigh);
return -ENOMEM;
}
memcpy(nr_neigh->digipeat, ax25_digi, sizeof(ax25_digi));
memcpy(nr_neigh->digipeat, ax25_digi,
sizeof(*ax25_digi));
}
spin_lock_bh(&nr_neigh_lock);
......@@ -387,7 +388,7 @@ static int nr_add_neigh(ax25_address *callsign, ax25_digi *ax25_digi, struct net
kfree(nr_neigh);
return -ENOMEM;
}
memcpy(nr_neigh->digipeat, ax25_digi, sizeof(ax25_digi));
memcpy(nr_neigh->digipeat, ax25_digi, sizeof(*ax25_digi));
}
spin_lock_bh(&nr_neigh_lock);
......
......@@ -2206,7 +2206,7 @@ static int snd_emu10k1_fx8010_info(emu10k1_t *emu, emu10k1_fx8010_info_t *info)
unsigned short fxbus_mask, extin_mask, extout_mask;
int res;
memset(info, 0, sizeof(info));
memset(info, 0, sizeof(*info));
info->card = emu->card_type;
info->internal_tram_size = emu->fx8010.itram_size;
info->external_tram_size = emu->fx8010.etram_size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment