Re: [PATCH v4 4/5] s390/vfio-ap: Add write support to sysfs attr ap_config

From: Alexander Gordeev
Date: Mon Apr 08 2024 - 10:22:50 EST


On Tue, Mar 26, 2024 at 12:47:05PM -0400, Jason J. Herne wrote:

Hi Jason,

This series still has some issues.

> + newbuf = rest = kstrndup(buf, AP_CONFIG_STRLEN, GFP_KERNEL);

This line triggers a checkpatch warning. Would it make sense
to turn it into below instead?

newbuf = kstrndup(buf, AP_CONFIG_STRLEN, GFP_KERNEL);
> + if (!newbuf)
> + return -ENOMEM;
rest = newbuf;

Also, please address other checkpatch suggestions.

> + /* Save old state */
> + /* The volatile cast here is to work around a gcc false positive
> + * Wstringop-overread-warning.
> + */
> + ap_matrix_copy(&m_old, (*(struct ap_matrix * volatile *)(&matrix_mdev->matrix)));

Could you please come up with a different workaround? This issue has already
been resolved in the past in different ways. See commit 34186b48d29b ("ARM:
sharpsl_param: work around -Wstringop-overread warning") for example.

Thanks!