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

Jason J. Herne
2024-04-12T12:29:50Z

On 4/8/24 10:22 AM, Alexander Gordeev wrote:
> 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;

Yes, I can make that change. My checkpatch.pl script does not point this
issue out with --strict. Should I be running checkpatch with --strict?

> Also, please address other checkpatch suggestions.
>

Yep, I'll run with --strict and address everything.

>> + /* 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.

Sure, I like this solution way better than using volatile. Thanks for
providing the pointer to this.