From 8c9b21bad052c794cd5934e8acfe3992ac30887b Mon Sep 17 00:00:00 2001 From: cym Date: Tue, 8 Oct 2013 15:02:19 +0800 Subject: [PATCH] ddrfreq:fix bug and add check vzalloc --- arch/arm/plat-rk/ddr_freq.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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; -- 2.34.1