/* Check if header of WSS information attribute valid */
static int wlp_check_wss_info_attr_hdr(struct wlp *wlp, struct wlp_attr_hdr *hdr, size_t buflen)
/* Check if header of WSS information attribute valid */
static int wlp_check_wss_info_attr_hdr(struct wlp *wlp, struct wlp_attr_hdr *hdr, size_t buflen)
{
	struct device *dev = &wlp->rc->uwb_dev.dev;
	size_t len;
	int result = 0;
	if (buflen < sizeof(*hdr)) {
		dev_err(dev, "WLP: Not enough space in buffer to parse"
			" WSS information attribute header.\n");
		result = -EIO;
		goto out;
	}
	if (le16_to_cpu(hdr->type) != WLP_ATTR_WSS_INFO) {
		result = -ENODATA;
		goto out;
	}
	len = le16_to_cpu(hdr->length);
	if (buflen < sizeof(*hdr) + len) {
		dev_err(dev, "WLP: Not enough space in buffer to parse "
			"variable data. Got %d, expected %d.\n",
			(int)buflen, (int)(sizeof(*hdr) + len));
		result = -EIO;
		goto out;
	}
	result = len;
out:
	return result;
}