hc
2024-05-14 bedbef8ad3e75a304af6361af235302bcc61d06b
kernel/drivers/nvmem/meson-mx-efuse.c
....@@ -1,16 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Amlogic Meson6, Meson8 and Meson8b eFuse Driver
34 *
45 * Copyright (c) 2017 Martin Blumenstingl <martin.blumenstingl@googlemail.com>
5
- *
6
- * This program is free software; you can redistribute it and/or modify it
7
- * under the terms of version 2 of the GNU General Public License as
8
- * published by the Free Software Foundation.
9
- *
10
- * This program is distributed in the hope that it will be useful, but WITHOUT
11
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13
- * more details.
146 */
157
168 #include <linux/bitfield.h>
....@@ -163,7 +155,8 @@
163155 if (err)
164156 break;
165157
166
- memcpy(buf + i, &tmp, efuse->config.word_size);
158
+ memcpy(buf + i, &tmp,
159
+ min_t(size_t, bytes - i, efuse->config.word_size));
167160 }
168161
169162 meson_mx_efuse_mask_bits(efuse, MESON_MX_EFUSE_CNTL1,