[LTP] [PATCH 2/2] setitimer03: convert to new API
Li Wang
liwang@redhat.com
Thu Oct 20 11:45:43 CEST 2022
On Thu, Oct 20, 2022 at 5:30 PM Li Wang <liwang@redhat.com> wrote:
> Richard Palethorpe <rpalethorpe@suse.de> wrote:
>
>
>> > -static struct itimerval *value;
>> > +static struct itimerval *value, *ovalue;
>> > +
>> > +static struct tcase {
>> > + int which;
>> > + struct itimerval **val;
>> > + struct itimerval **oval;
>> > + int exp_errno;
>>
>> There is a whitespace error here (see checkpatch/make check)
>>
>
> yes, thanks.
>
>
>
>>
>> > +} tcases[] = {
>> > + {ITIMER_REAL, &value, &ovalue, EFAULT},
>> > + {ITIMER_VIRTUAL, &value, &ovalue, EFAULT},
>> > + {-ITIMER_PROF, &value, &ovalue, EINVAL},
>> > +};
>>
>> Why do we need value and ovalue in the struct?
>>
>
> Becuase it does not allow parsing an invalid pointer address
> from a structure, we have to give a valid address which pointer
> to save an invalid address. Otherwise segement fault will
> be hit in execution.
>
On the other side, it also does not allow to initializer element
is not constant in structure. So the two-level pointer is only the
way I can make all things comprised here.
--
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20221020/7127f246/attachment-0001.htm>
More information about the ltp
mailing list