New python PIDL checks cause 2221 new Coverity warnings

Stefan Metzmacher metze at
Thu Aug 27 09:54:47 UTC 2015

Hi Volker,

>> Finally, we should try to keep the solution as generic as possible, as
>> when we add new base types to PIDL, all these lists need to be updated,
>> and the person who is doing so probably won't remember the full
>> background.
> If you don't want to put ifdefs into generated code, can't we put that
> into a handcrafted helper function and call that in the autogenerated
> code?

That's a really good idea!

In such a helper function we could just avoid doing bit shifting
at all.

I really didn't like the horrible magic with bit shifting,
but I verified it works and gave my review in order to fix the
important replication bug.

But given these side effects, we really need to do something about it!

const unsigned long long uint_max = (sizeof($target) == 8) ? UINT64_MAX
: (unsigned long long)((1ULL << (sizeof($target) * 8)) - 1);");

should be come:

const uintmax_t uint_max = ndr_sizeof2uintmax(sizeof($target));

uintmax_t ndr_sizeof2uintmax(size_t sizeof)

	switch (sizeof) {
	case 8:
		return INT64_MAX;
	case 4:
		return INT32_MAX:

	return 0;

A similar thing for ndr_sizeof2intmax().

Andrew, please provide patches to implement the above changes.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the samba-technical mailing list