aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-u2fzero.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid/hid-u2fzero.c')
-rw-r--r--drivers/hid/hid-u2fzero.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/hid/hid-u2fzero.c b/drivers/hid/hid-u2fzero.c
index 95e0807878c7..d70cd3d7f583 100644
--- a/drivers/hid/hid-u2fzero.c
+++ b/drivers/hid/hid-u2fzero.c
@@ -198,7 +198,9 @@ static int u2fzero_rng_read(struct hwrng *rng, void *data,
}
ret = u2fzero_recv(dev, &req, &resp);
- if (ret < 0)
+
+ /* ignore errors or packets without data */
+ if (ret < offsetof(struct u2f_hid_msg, init.data))
return 0;
/* only take the minimum amount of data it is safe to take */