Commit bb0f5eb9 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: rest of drivers/net annotations in the patchset

s2io.c: bogus initializer ({{"a"},{"b"}} has too many braces for
two-dimensional array of char - strings are arrays themselves).

de4x5.h: missing __user on a pointer in ioctl structure. 

airo.c: cleaned up and fixed procfs ->read() and ->write()
parent 38418a28
...@@ -99,45 +99,45 @@ static char s2io_gstrings[][ETH_GSTRING_LEN] = { ...@@ -99,45 +99,45 @@ static char s2io_gstrings[][ETH_GSTRING_LEN] = {
}; };
static char ethtool_stats_keys[][ETH_GSTRING_LEN] = { static char ethtool_stats_keys[][ETH_GSTRING_LEN] = {
{"tmac_frms"}, "tmac_frms",
{"tmac_data_octets"}, "tmac_data_octets",
{"tmac_drop_frms"}, "tmac_drop_frms",
{"tmac_mcst_frms"}, "tmac_mcst_frms",
{"tmac_bcst_frms"}, "tmac_bcst_frms",
{"tmac_pause_ctrl_frms"}, "tmac_pause_ctrl_frms",
{"tmac_any_err_frms"}, "tmac_any_err_frms",
{"tmac_vld_ip_octets"}, "tmac_vld_ip_octets",
{"tmac_vld_ip"}, "tmac_vld_ip",
{"tmac_drop_ip"}, "tmac_drop_ip",
{"tmac_icmp"}, "tmac_icmp",
{"tmac_rst_tcp"}, "tmac_rst_tcp",
{"tmac_tcp"}, "tmac_tcp",
{"tmac_udp"}, "tmac_udp",
{"rmac_vld_frms"}, "rmac_vld_frms",
{"rmac_data_octets"}, "rmac_data_octets",
{"rmac_fcs_err_frms"}, "rmac_fcs_err_frms",
{"rmac_drop_frms"}, "rmac_drop_frms",
{"rmac_vld_mcst_frms"}, "rmac_vld_mcst_frms",
{"rmac_vld_bcst_frms"}, "rmac_vld_bcst_frms",
{"rmac_in_rng_len_err_frms"}, "rmac_in_rng_len_err_frms",
{"rmac_long_frms"}, "rmac_long_frms",
{"rmac_pause_ctrl_frms"}, "rmac_pause_ctrl_frms",
{"rmac_discarded_frms"}, "rmac_discarded_frms",
{"rmac_usized_frms"}, "rmac_usized_frms",
{"rmac_osized_frms"}, "rmac_osized_frms",
{"rmac_frag_frms"}, "rmac_frag_frms",
{"rmac_jabber_frms"}, "rmac_jabber_frms",
{"rmac_ip"}, "rmac_ip",
{"rmac_ip_octets"}, "rmac_ip_octets",
{"rmac_hdr_err_ip"}, "rmac_hdr_err_ip",
{"rmac_drop_ip"}, "rmac_drop_ip",
{"rmac_icmp"}, "rmac_icmp",
{"rmac_tcp"}, "rmac_tcp",
{"rmac_udp"}, "rmac_udp",
{"rmac_err_drp_udp"}, "rmac_err_drp_udp",
{"rmac_pause_cnt"}, "rmac_pause_cnt",
{"rmac_accepted_ip"}, "rmac_accepted_ip",
{"rmac_err_tcp"}, "rmac_err_tcp",
}; };
#define S2IO_STAT_LEN sizeof(ethtool_stats_keys)/ ETH_GSTRING_LEN #define S2IO_STAT_LEN sizeof(ethtool_stats_keys)/ ETH_GSTRING_LEN
......
...@@ -1005,7 +1005,7 @@ ...@@ -1005,7 +1005,7 @@
struct de4x5_ioctl { struct de4x5_ioctl {
unsigned short cmd; /* Command to run */ unsigned short cmd; /* Command to run */
unsigned short len; /* Length of the data buffer */ unsigned short len; /* Length of the data buffer */
unsigned char *data; /* Pointer to the data buffer */ unsigned char __user *data; /* Pointer to the data buffer */
}; };
/* /*
......
...@@ -897,7 +897,7 @@ typedef struct aironet_ioctl { ...@@ -897,7 +897,7 @@ typedef struct aironet_ioctl {
unsigned short command; // What to do unsigned short command; // What to do
unsigned short len; // Len of data unsigned short len; // Len of data
unsigned short ridnum; // rid number unsigned short ridnum; // rid number
unsigned char *data; // d-data unsigned char __user *data; // d-data
} aironet_ioctl; } aironet_ioctl;
static char *swversion = "2.1"; static char *swversion = "2.1";
...@@ -4272,12 +4272,12 @@ static int transmit_802_11_packet(struct airo_info *ai, int len, char *pPacket) ...@@ -4272,12 +4272,12 @@ static int transmit_802_11_packet(struct airo_info *ai, int len, char *pPacket)
*/ */
static ssize_t proc_read( struct file *file, static ssize_t proc_read( struct file *file,
char *buffer, char __user *buffer,
size_t len, size_t len,
loff_t *offset); loff_t *offset);
static ssize_t proc_write( struct file *file, static ssize_t proc_write( struct file *file,
const char *buffer, const char __user *buffer,
size_t len, size_t len,
loff_t *offset ); loff_t *offset );
static int proc_close( struct inode *inode, struct file *file ); static int proc_close( struct inode *inode, struct file *file );
...@@ -4482,23 +4482,26 @@ static int takedown_proc_entry( struct net_device *dev, ...@@ -4482,23 +4482,26 @@ static int takedown_proc_entry( struct net_device *dev,
* to supply the data. * to supply the data.
*/ */
static ssize_t proc_read( struct file *file, static ssize_t proc_read( struct file *file,
char *buffer, char __user *buffer,
size_t len, size_t len,
loff_t *offset ) loff_t *offset )
{ {
int i; loff_t pos = *offset;
int pos;
struct proc_data *priv = (struct proc_data*)file->private_data; struct proc_data *priv = (struct proc_data*)file->private_data;
if( !priv->rbuffer ) return -EINVAL; if (!priv->rbuffer)
return -EINVAL;
pos = *offset; if (pos < 0)
for( i = 0; i+pos < priv->readlen && i < len; i++ ) { return -EINVAL;
if (put_user( priv->rbuffer[i+pos], buffer+i )) if (pos >= priv->readlen)
return 0;
if (len > priv->readlen - pos)
len = priv->readlen - pos;
if (copy_to_user(buffer, priv->rbuffer + pos, len))
return -EFAULT; return -EFAULT;
} *offset = pos + len;
*offset += i; return len;
return i;
} }
/* /*
...@@ -4506,28 +4509,26 @@ static ssize_t proc_read( struct file *file, ...@@ -4506,28 +4509,26 @@ static ssize_t proc_read( struct file *file,
* to supply the data. * to supply the data.
*/ */
static ssize_t proc_write( struct file *file, static ssize_t proc_write( struct file *file,
const char *buffer, const char __user *buffer,
size_t len, size_t len,
loff_t *offset ) loff_t *offset )
{ {
int i; loff_t pos = *offset;
int pos;
struct proc_data *priv = (struct proc_data*)file->private_data; struct proc_data *priv = (struct proc_data*)file->private_data;
if ( !priv->wbuffer ) { if (!priv->wbuffer)
return -EINVAL; return -EINVAL;
}
pos = *offset;
for( i = 0; i + pos < priv->maxwritelen && if (pos < 0)
i < len; i++ ) { return -EINVAL;
if (get_user( priv->wbuffer[i+pos], buffer + i )) if (pos >= priv->maxwritelen)
return 0;
if (len > priv->maxwritelen - pos)
len = priv->maxwritelen - pos;
if (copy_from_user(priv->wbuffer + pos, buffer, len))
return -EFAULT; return -EFAULT;
} *offset = pos + len;
if ( i+pos > priv->writelen ) priv->writelen = i+file->f_pos; return len;
*offset += i;
return i;
} }
static int proc_status_open( struct inode *inode, struct file *file ) { static int proc_status_open( struct inode *inode, struct file *file ) {
......
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