[LTP] [PATCH v4 9/9] [RFC] metaparse: Check {min, max}_kver validity

Petr Vorel pvorel@suse.cz
Mon Aug 10 13:23:39 CEST 2026


Hi Cyril,

...
> > +	/* Check max_kver >= min_kver */
> > +	struct data_node *max_kver = data_node_hash_get(res, "max_kver");
> > +	struct data_node *min_kver = data_node_hash_get(res, "min_kver");
> > +	int a1, a2, a3, b1, b2, b3;
> > +
> > +	if (min_kver) {
> > +		assert(min_kver->type == DATA_STRING);
> > +		if (tst_parse_kver(min_kver->string.val, &b1, &b2, &b3)) {
> > +			fprintf(stderr, "%s: wrong min_kver: '%s'\n",
> > +				argv[optind], min_kver->string.val);
> > +			return 1;
> > +		}
> > +	}
> > +
> > +	if (max_kver) {
> > +		assert(max_kver->type == DATA_STRING);
> > +		if (tst_parse_kver(max_kver->string.val, &a1, &a2, &a3)) {
> > +			fprintf(stderr, "%s: wrong max_kver: '%s'\n",
> > +					argv[optind], max_kver->string.val);
> > +			return 1;
> > +		}
> > +	}
> > +
> > +	if (min_kver && max_kver) {
> > +		if (tst_kver_cmp(a1, a2, a3, b1, b2, b3) < 0) {
> > +			fprintf(stderr, "%s: min_kver (%s) > max_kver (%s)\n",
> > +					argv[optind], min_kver->string.val, max_kver->string.val);
> > +			return 1;
> > +		}
> > +	}
> > +

> Andrea is working on metadata linter, that does much more than this,
> e.g. checks that CVE record is valid.

> This looks like a check that could be added more easily there.

Thanks for info, sounds good. I'll remove last 3 patches (2 of them are RFC, I
suppose "tst_kvercmp: Factor out 2 kernels integer comparison" could be used by
Andrea in that linter).

Anyway, I consider the rest ready (agent complains are IMHO wrong), but I'll
resend.

Kind regards,
Petr


More information about the ltp mailing list