/* This function returns the number of padding bytes on success and SCANNED_GARBAGE on failure.  */
static int scan_padding_bytes(void *buf, int len)
/* This function returns the number of padding bytes on success and SCANNED_GARBAGE on failure.  */
static int scan_padding_bytes(void *buf, int len)
{
	int pad_len = 0, max_pad_len = min_t(int, UBIFS_PAD_NODE_SZ, len);
	uint8_t *p = buf;
	dbg_scan("not a node");
	while (pad_len < max_pad_len && *p++ == UBIFS_PADDING_BYTE)
		pad_len += 1;
	if (!pad_len || (pad_len & 7))
		return SCANNED_GARBAGE;
	dbg_scan("%d padding bytes", pad_len);
	return pad_len;
}