From: cym Date: Tue, 8 Oct 2013 07:02:19 +0000 (+0800) Subject: ddrfreq:fix bug and add check vzalloc X-Git-Tag: firefly_0821_release~6580 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8c9b21bad052c794cd5934e8acfe3992ac30887b;p=firefly-linux-kernel-4.4.55.git ddrfreq:fix bug and add check vzalloc --- diff --git a/arch/arm/plat-rk/ddr_freq.c b/arch/arm/plat-rk/ddr_freq.c index 0ae0b7d16f20..c105e457c2bc 100755 --- a/arch/arm/plat-rk/ddr_freq.c +++ b/arch/arm/plat-rk/ddr_freq.c @@ -300,9 +300,14 @@ static ssize_t video_state_write(struct file *file, const char __user *buffer, uint32_t v_width=0,v_height=0,v_sync=0; cookie_pot = buf; - if (count < 1) + if(!buf) + return -ENOMEM; + + if (count < 1){ vfree(buf); - return count; + return -EPERM; + } + if (copy_from_user(cookie_pot, buffer, count)) { vfree(buf); return -EFAULT;