On Tuesday 12 May 2015 22:10:14 Baolin Wang wrote:
+static int default_timer_set64(struct k_itimer *timr, int flags,
struct itimerspec64 *new_setting64,
struct itimerspec64 *old_setting64)
+{
struct k_clock *kc = clockid_to_kclock(timr->it_clock);
struct itimerspec new_setting, old_setting;
int ret;
new_setting = itimerspec64_to_itimerspec(new_setting64);
old_setting = itimerspec64_to_itimerspec(old_setting64);
ret = kc->timer_set(timr, flags, &new_setting, &old_setting);
if (!ret && old_setting64)
*old_setting64 = itimerspec_to_itimerspec64(&old_setting);
return ret;
+}
You check old_setting64 for a NULL pointer in the second access, but not in the first one, which is a bug. Please also check whether the variable is used as input, output or both.
Arnd