Changeset 3438

Show
Ignore:
Timestamp:
01/24/00 22:41:19 (13 years ago)
Author:
frodo
Message:

Russell King's warnings about faults integrated

Location:
i2c/trunk/kernel
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • i2c/trunk/kernel/i2c-core.c

    r3436 r3438  
    500500                                        if (len < 0)  
    501501                                                len = 0; 
    502                                         copy_to_user (buf,kbuf+file->f_pos,len); 
     502                                        if (copy_to_user (buf,kbuf+file->f_pos, 
     503                                            len)) { 
     504                                                kfree(kbuf); 
     505                                                return -EFAULT; 
     506                                        } 
    503507                                        file->f_pos += len; 
    504508                                        kfree(kbuf); 
  • i2c/trunk/kernel/i2c-dev.c

    r3437 r3438  
    149149        ret = i2c_master_recv(client,tmp,count); 
    150150        if (! ret) 
    151                 copy_to_user(buf,tmp,count); 
     151                ret = copy_to_user(buf,tmp,count)?-EFAULT:0; 
    152152        kfree(tmp); 
    153153        return ret; 
     
    169169        if (tmp==NULL) 
    170170                return -ENOMEM; 
    171         copy_from_user(tmp,buf,count); 
     171        if (copy_from_user(tmp,buf,count)) { 
     172                kfree(tmp); 
     173                return -EFAULT; 
     174        } 
    172175 
    173176#ifdef DEBUG