[linux-dvb] Sparse cleanups for bt8xx/dst_ca.c

Manu Abraham abraham.manu at gmail.com
Fri Sep 16 13:42:40 CEST 2005


Peter Hagervall wrote:

>Remove a number of address space related warnings.
>
>  
>
Ack'd. I will apply to CVS tree..

Thanks,
Manu


Signed-off-by: Manu Abraham <manu at linuxtv.org>

>Signed-off-by: Peter Hagervall <hager at cs.umu.se>
>---
>
> dst_ca.c |   27 ++++++++++++++-------------
> 1 files changed, 14 insertions(+), 13 deletions(-)
>
>
>diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c
>--- a/drivers/media/dvb/bt8xx/dst_ca.c
>+++ b/drivers/media/dvb/bt8xx/dst_ca.c
>@@ -166,7 +166,7 @@ static int ca_get_app_info(struct dst_st
> 	return 0;
> }
> 
>-static int ca_get_slot_caps(struct dst_state *state, struct ca_caps *p_ca_caps, void *arg)
>+static int ca_get_slot_caps(struct dst_state *state, struct ca_caps *p_ca_caps, void __user *arg)
> {
> 	int i;
> 	u8 slot_cap[256];
>@@ -192,20 +192,20 @@ static int ca_get_slot_caps(struct dst_s
> 	p_ca_caps->descr_num = slot_cap[7];
> 	p_ca_caps->descr_type = 1;
> 
>-	if (copy_to_user((struct ca_caps *)arg, p_ca_caps, sizeof (struct ca_caps)))
>+	if (copy_to_user(arg, p_ca_caps, sizeof (struct ca_caps)))
> 		return -EFAULT;
> 
> 	return 0;
> }
> 
> /*	Need some more work	*/
>-static int ca_get_slot_descr(struct dst_state *state, struct ca_msg *p_ca_message, void *arg)
>+static int ca_get_slot_descr(struct dst_state *state, struct ca_msg *p_ca_message, void __user *arg)
> {
> 	return -EOPNOTSUPP;
> }
> 
> 
>-static int ca_get_slot_info(struct dst_state *state, struct ca_slot_info *p_ca_slot_info, void *arg)
>+static int ca_get_slot_info(struct dst_state *state, struct ca_slot_info *p_ca_slot_info, void __user *arg)
> {
> 	int i;
> 	static u8 slot_command[8] = {0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff};
>@@ -238,19 +238,19 @@ static int ca_get_slot_info(struct dst_s
> 	} else
> 		p_ca_slot_info->flags = 0;
> 
>-	if (copy_to_user((struct ca_slot_info *)arg, p_ca_slot_info, sizeof (struct ca_slot_info)))
>+	if (copy_to_user(arg, p_ca_slot_info, sizeof (struct ca_slot_info)))
> 		return -EFAULT;
> 
> 	return 0;
> }
> 
> 
>-static int ca_get_message(struct dst_state *state, struct ca_msg *p_ca_message, void *arg)
>+static int ca_get_message(struct dst_state *state, struct ca_msg *p_ca_message, void __user *arg)
> {
> 	u8 i = 0;
> 	u32 command = 0;
> 
>-	if (copy_from_user(p_ca_message, (void *)arg, sizeof (struct ca_msg)))
>+	if (copy_from_user(p_ca_message, arg, sizeof (struct ca_msg)))
> 		return -EFAULT;
> 
> 	if (p_ca_message->msg) {
>@@ -266,7 +266,7 @@ static int ca_get_message(struct dst_sta
> 		switch (command) {
> 		case CA_APP_INFO:
> 			memcpy(p_ca_message->msg, state->messages, 128);
>-			if (copy_to_user((void *)arg, p_ca_message, sizeof (struct ca_msg)) )
>+			if (copy_to_user(arg, p_ca_message, sizeof (struct ca_msg)) )
> 				return -EFAULT;
> 			break;
> 		}
>@@ -315,7 +315,7 @@ static int write_to_8820(struct dst_stat
> 	return 0;
> }
> 
>-u32 asn_1_decode(u8 *asn_1_array)
>+static u32 asn_1_decode(u8 *asn_1_array)
> {
> 	u8 length_field = 0, word_count = 0, count = 0;
> 	u32 length = 0;
>@@ -399,7 +399,7 @@ static int dst_check_ca_pmt(struct dst_s
> 	return 0;
> }
> 
>-static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, void *arg)
>+static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, void __user *arg)
> {
> 	int i = 0;
> 	unsigned int ca_message_header_len;
>@@ -413,7 +413,7 @@ static int ca_send_message(struct dst_st
> 	}
> 	dprintk(verbose, DST_CA_DEBUG, 1, " ");
> 
>-	if (copy_from_user(p_ca_message, (void *)arg, sizeof (struct ca_msg)))
>+	if (copy_from_user(p_ca_message, arg, sizeof (struct ca_msg)))
> 		return -EFAULT;
> 
> 	if (p_ca_message->msg) {
>@@ -460,13 +460,14 @@ static int ca_send_message(struct dst_st
> 	return 0;
> }
> 
>-static int dst_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd, void *arg)
>+static int dst_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long ioctl_arg)
> {
> 	struct dvb_device* dvbdev = (struct dvb_device*) file->private_data;
> 	struct dst_state* state = (struct dst_state*) dvbdev->priv;
> 	struct ca_slot_info *p_ca_slot_info;
> 	struct ca_caps *p_ca_caps;
> 	struct ca_msg *p_ca_message;
>+	void __user *arg = (void __user *)ioctl_arg;
> 
> 	if ((p_ca_message = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) {
> 		dprintk(verbose, DST_CA_ERROR, 1, " Memory allocation failure");
>@@ -582,7 +583,7 @@ static int dst_ca_write(struct file *fil
> 
> static struct file_operations dst_ca_fops = {
> 	.owner = THIS_MODULE,
>-	.ioctl = (void *)dst_ca_ioctl,
>+	.ioctl = dst_ca_ioctl,
> 	.open = dst_ca_open,
> 	.release = dst_ca_release,
> 	.read = dst_ca_read,
>
>_______________________________________________
>linux-dvb mailing list
>linux-dvb at linuxtv.org
>http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
>
>  
>




More information about the linux-dvb mailing list