linux-next: manual merge of the staging tree with the vfs tree

From: Stephen Rothwell
Date: Wed Apr 10 2013 - 01:55:12 EST


Hi Greg,

Today's linux-next merge of the staging tree got a conflict in
drivers/staging/vt6655/device_main.c between commit f805442e130c
("vt6655: slightly clean reading config file") from the vfs tree and
commits 915006cddc79 ("staging:vt6655:device_main: Whitespace cleanups")
and 5e0cc8a231be ("staging: vt6655: Convert to kernel brace style") from
the staging tree.

I fixed it up (I think - see below) and can carry the fix as necessary
(no action is required).

--
Cheers,
Stephen Rothwell sfr@xxxxxxxxxxxxxxxx

diff --cc drivers/staging/vt6655/device_main.c
index a89ab9b,be4f6c2..0000000
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@@ -2933,39 -2723,61 +2724,39 @@@ static inline u32 ether_crc(int length

//2008-8-4 <add> by chester
static int Config_FileGetParameter(unsigned char *string,
- unsigned char *dest, unsigned char *source)
+ unsigned char *dest, unsigned char *source)
{
- unsigned char buf1[100];
- int source_len = strlen(source);
+ unsigned char buf1[100];
+ int source_len = strlen(source);

- memset(buf1,0,100);
- strcat(buf1, string);
- strcat(buf1, "=");
- source+=strlen(buf1);
+ memset(buf1, 0, 100);
+ strcat(buf1, string);
+ strcat(buf1, "=");
+ source += strlen(buf1);

- memcpy(dest,source,source_len-strlen(buf1));
- return true;
+ memcpy(dest, source, source_len - strlen(buf1));
+ return true;
}

- int Config_FileOperation(PSDevice pDevice,bool fwrite,unsigned char *Parameter)
-int Config_FileOperation(PSDevice pDevice, bool fwrite, unsigned char *Parameter) {
- unsigned char *config_path = CONFIG_PATH;
- unsigned char *buffer = NULL;
++int Config_FileOperation(PSDevice pDevice, bool fwrite, unsigned char *Parameter)
+{
+ unsigned char *buffer = kmalloc(1024, GFP_KERNEL);
unsigned char tmpbuffer[20];
- struct file *filp = NULL;
- mm_segment_t old_fs = get_fs();
- //int oldfsuid=0,oldfsgid=0;
+ struct file *file;
- int result=0;
+ int result = 0;

- set_fs(KERNEL_DS);
-
- /* Can't do this anymore, so we rely on correct filesystem permissions:
- //Make sure a caller can read or write power as root
- oldfsuid=current->cred->fsuid;
- oldfsgid=current->cred->fsgid;
- current->cred->fsuid = 0;
- current->cred->fsgid = 0;
- */
-
- //open file
- filp = filp_open(config_path, O_RDWR, 0);
- if (IS_ERR(filp)) {
- printk("Config_FileOperation:open file fail?\n");
- result = -1;
- goto error2;
- }
-
- if (!(filp->f_op) || !(filp->f_op->read) || !(filp->f_op->write)) {
- printk("file %s cann't readable or writable?\n", config_path);
- result = -1;
- goto error1;
- }
-
- buffer = kmalloc(1024, GFP_KERNEL);
- if (buffer == NULL) {
+ if (!buffer) {
printk("allocate mem for file fail?\n");
- result = -1;
- goto error1;
+ return -1;
+ }
+ file = filp_open(CONFIG_PATH, O_RDONLY, 0);
+ if (IS_ERR(file)) {
+ kfree(buffer);
+ printk("Config_FileOperation:open file fail?\n");
+ return -1;
}

- if (filp->f_op->read(filp, buffer, 1024, &filp->f_pos) < 0) {
+ if (kernel_read(file, 0, buffer, 1024) < 0) {
printk("read file error?\n");
result = -1;
goto error1;

Attachment: pgp00000.pgp
Description: PGP signature