Another thing to note: Given the union of validation_data pointer and min/max, we'll always get into this: > + /* validate range */ > + if (pt->min || pt->max) { if validation_data is set, but of course end up taking the default case, where nothing further happens: > + default: > + /* no further validation */ > + validate = false; > + break; > + } > + > + if (validate && (value < pt->min || value > pt->max)) { > + NL_SET_ERR_MSG_ATTR(extack, nla, > + "integer out of range"); > + return -ERANGE; > + } > + } > + > return 0; I'm not *entirely* happy with this, but I haven't been able to come up with a way that doesn't do this, doesn't duplicate the nla types list (NLA_{U,S}{8,16,32,64}) in the code, and also loads the attribute value only if validation is needed. johannes