• Gustavo A. R. Silva's avatar
    ASoC: SOF: Use struct_size() in kmemdup() · b11c5b5e
    Gustavo A. R. Silva authored
    Make use of the struct_size() helper instead of an open-coded version
    in order to avoid any potential type mistakes, in particular in the
    context in which this code is being used.
    
    So, replace code of the following form:
    
    sizeof(*w) + sizeof(struct sof_ipc_window_elem) * w->num_windows
    
    with:
    
    struct_size(w, window, w->num_windows)
    
    Notice that variable size is unnecessary, hence it is removed.
    
    This code was detected with the help of Coccinelle.
    Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    b11c5b5e
loader.c 9.85 KB