{
int err = 0;
loff_t pos = 0;
- char buftmp[EFUSE_BUF_SIZE] = {0};
+ char *buftmp;
+
+ buftmp = kzalloc(EFUSE_BUF_SIZE, GFP_KERNEL);
+ if (!buftmp) {
+ MYPRT("kzalloc fail.\n");
+ return -ENOMEM;
+ }
MYPRT("[%s]\n", __func__);
if (count > EFUSE_BUF_SIZE) {
}
}
}
+
+ kfree(buftmp);
if (!err)
return count;
else
int consumerir_freqs = 0, duty_cycle = 0;
s32 r = 0;
- char sendcode[MAX_PLUSE];
+ char *sendcode;
void __user *argp = (void __user *)args;
+ sendcode = kzalloc(MAX_PLUSE, GFP_KERNEL);
+ if (!sendcode)
+ return -ENOMEM;
+
irblaster_dbg("aml_irblaster_ioctl() 0x%4x\n ", cmd);
switch (cmd) {
case CONSUMERIR_TRANSMIT:
if (copy_from_user(sendcode, (char *)argp,
- strlen((char *)argp)))
+ strlen((char *)argp))) {
+ kfree(sendcode);
return -EFAULT;
+ }
pr_info("send code is %s\n", sendcode);
r = send(sendcode, strlen(argp));
break;
pr_info("in get freq\n");
consumerir_freqs = get_consumerir_freqs(irblaster);
put_user(consumerir_freqs, (int *)argp);
+ kfree(sendcode);
return consumerir_freqs;
case SET_CARRIER:
pr_info("in set freq\n");
break;
case SET_DUTYCYCLE:
pr_info("in set duty_cycle\n");
- if (copy_from_user(&duty_cycle, argp, sizeof(int)))
+ if (copy_from_user(&duty_cycle, argp, sizeof(int))) {
+ kfree(sendcode);
return -EFAULT;
+ }
get_user(duty_cycle, (int *)argp);
r = set_duty_cycle(duty_cycle);
break;
break;
}
+ kfree(sendcode);
return r;
}
static int aml_irblaster_release(struct inode *inode, struct file *file)
int consumerir_freqs = 0, duty_cycle = 0;
s32 r = 0;
- char sendcode[MAX_PLUSE];
+ char *sendcode;
void __user *argp = (void __user *)args;
+ sendcode = kzalloc(MAX_PLUSE, GFP_KERNEL);
+ if (!sendcode)
+ return -ENOMEM;
+
irblaster_dbg("aml_ir_blaster_ioctl() 0x%4x\n ", cmd);
switch (cmd) {
case CONSUMERIR_TRANSMIT:
if (copy_from_user(sendcode, (char *)argp,
- strlen((char *)argp)))
+ strlen((char *)argp))) {
+ kfree(sendcode);
return -EFAULT;
+ }
pr_info("send code is %s\n", sendcode);
r = irblaster_send(sendcode, strlen(argp));
break;
consumerir_freqs =
get_irblaster_consumerir_freqs(irblaster_win);
put_user(consumerir_freqs, (int *)argp);
+ kfree(sendcode);
return consumerir_freqs;
case SET_CARRIER:
pr_info("in set freq\n");
break;
case SET_DUTYCYCLE:
pr_info("in set duty_cycle\n");
- if (copy_from_user(&duty_cycle, argp, sizeof(int)))
+ if (copy_from_user(&duty_cycle, argp, sizeof(int))) {
+ kfree(sendcode);
return -EFAULT;
+ }
get_user(duty_cycle, (int *)argp);
r = set_irblaster_duty_cycle(duty_cycle);
break;
break;
}
+ kfree(sendcode);
return r;
}
static int aml_ir_blaster_release(struct inode *inode, struct file *file)
int cpy = 1, valid = 0;
int bit = mmc->csd.read_blkbits;
int blk;
+#ifdef CONFIG_ARM64
unsigned int pgcnt;
struct page *page = NULL;
if (!page)
return -ENOMEM;
dtb = page_address(page);
+#else
+ dtb = kmalloc(CONFIG_DTB_SIZE, GFP_KERNEL);
+ if (!dtb)
+ return -ENOMEM;
+#endif
/* read dtb2 1st, for compatibility without checksum. */
while (cpy >= 0) {
}
pr_info("total valid %d\n", valid);
+#ifdef CONFIG_ARM64
dma_release_from_contiguous(NULL, page, pgcnt);
+#else
+ kfree(dtb);
+#endif
return ret;
}