Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: dmatest: use strscpy to replace strlcpy

The strlcpy should not be used because it doesn't limit the source
length. Preferred is strscpy.

Signed-off-by: XueBing Chen <chenxuebing@jari.cn>
Link: https://lore.kernel.org/r/12e4cf06.a35.180fa748c29.Coremail.chenxuebing@jari.cn
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

XueBing Chen and committed by
Vinod Koul
6bc7ea3c a71da24c

+6 -6
+6 -6
drivers/dma/dmatest.c
··· 1101 1101 1102 1102 /* Copy test parameters */ 1103 1103 params->buf_size = test_buf_size; 1104 - strlcpy(params->channel, strim(test_channel), sizeof(params->channel)); 1105 - strlcpy(params->device, strim(test_device), sizeof(params->device)); 1104 + strscpy(params->channel, strim(test_channel), sizeof(params->channel)); 1105 + strscpy(params->device, strim(test_device), sizeof(params->device)); 1106 1106 params->threads_per_chan = threads_per_chan; 1107 1107 params->max_channels = max_channels; 1108 1108 params->iterations = iterations; ··· 1246 1246 dtc = list_last_entry(&info->channels, 1247 1247 struct dmatest_chan, 1248 1248 node); 1249 - strlcpy(chan_reset_val, 1249 + strscpy(chan_reset_val, 1250 1250 dma_chan_name(dtc->chan), 1251 1251 sizeof(chan_reset_val)); 1252 1252 ret = -EBUSY; ··· 1269 1269 if ((strcmp(dma_chan_name(dtc->chan), strim(test_channel)) != 0) 1270 1270 && (strcmp("", strim(test_channel)) != 0)) { 1271 1271 ret = -EINVAL; 1272 - strlcpy(chan_reset_val, dma_chan_name(dtc->chan), 1272 + strscpy(chan_reset_val, dma_chan_name(dtc->chan), 1273 1273 sizeof(chan_reset_val)); 1274 1274 goto add_chan_err; 1275 1275 } 1276 1276 1277 1277 } else { 1278 1278 /* Clear test_channel if no channels were added successfully */ 1279 - strlcpy(chan_reset_val, "", sizeof(chan_reset_val)); 1279 + strscpy(chan_reset_val, "", sizeof(chan_reset_val)); 1280 1280 ret = -EBUSY; 1281 1281 goto add_chan_err; 1282 1282 } ··· 1301 1301 mutex_lock(&info->lock); 1302 1302 if (!is_threaded_test_run(info) && !is_threaded_test_pending(info)) { 1303 1303 stop_threaded_test(info); 1304 - strlcpy(test_channel, "", sizeof(test_channel)); 1304 + strscpy(test_channel, "", sizeof(test_channel)); 1305 1305 } 1306 1306 mutex_unlock(&info->lock); 1307 1307