+ case LTTNG_KERNEL_OLD_EVENT:
+ {
+ struct lttng_kernel_event *uevent_param;
+ struct lttng_kernel_old_event *old_uevent_param;
+ int ret;
+
+ uevent_param = kmalloc(sizeof(struct lttng_kernel_event),
+ GFP_KERNEL);
+ if (!uevent_param) {
+ ret = -ENOMEM;
+ goto old_event_end;
+ }
+ old_uevent_param = kmalloc(
+ sizeof(struct lttng_kernel_old_event),
+ GFP_KERNEL);
+ if (!old_uevent_param) {
+ ret = -ENOMEM;
+ goto old_event_error_free_param;
+ }
+ if (copy_from_user(old_uevent_param,
+ (struct lttng_kernel_old_event __user *) arg,
+ sizeof(struct lttng_kernel_old_event))) {
+ ret = -EFAULT;
+ goto old_event_error_free_old_param;
+ }
+
+ memcpy(uevent_param->name, old_uevent_param->name,
+ sizeof(uevent_param->name));
+ uevent_param->instrumentation =
+ old_uevent_param->instrumentation;
+
+ switch (old_uevent_param->instrumentation) {
+ case LTTNG_KERNEL_KPROBE:
+ uevent_param->u.kprobe.addr =
+ old_uevent_param->u.kprobe.addr;
+ uevent_param->u.kprobe.offset =
+ old_uevent_param->u.kprobe.offset;
+ memcpy(uevent_param->u.kprobe.symbol_name,
+ old_uevent_param->u.kprobe.symbol_name,
+ sizeof(uevent_param->u.kprobe.symbol_name));
+ break;
+ case LTTNG_KERNEL_KRETPROBE:
+ uevent_param->u.kretprobe.addr =
+ old_uevent_param->u.kretprobe.addr;
+ uevent_param->u.kretprobe.offset =
+ old_uevent_param->u.kretprobe.offset;
+ memcpy(uevent_param->u.kretprobe.symbol_name,
+ old_uevent_param->u.kretprobe.symbol_name,
+ sizeof(uevent_param->u.kretprobe.symbol_name));
+ break;
+ case LTTNG_KERNEL_FUNCTION:
+ memcpy(uevent_param->u.ftrace.symbol_name,
+ old_uevent_param->u.ftrace.symbol_name,
+ sizeof(uevent_param->u.ftrace.symbol_name));
+ break;
+ default:
+ break;
+ }
+ ret = lttng_abi_create_event(file, uevent_param);
+
+old_event_error_free_old_param:
+ kfree(old_uevent_param);
+old_event_error_free_param:
+ kfree(uevent_param);
+old_event_end:
+ return ret;
+ }