On 7/19/2023 12:31 AM, Winston Wen wrote:
On Tue, 18 Jul 2023 10:42:27 -0500
Steve French <smfrench@xxxxxxxxx> wrote:
I get compile warning:
/home/smfrench/cifs-2.6/fs/smb/client/connect.c: In function
‘cifs_get_smb_ses’:
/home/smfrench/cifs-2.6/fs/smb/client/connect.c:2293:49: warning:
passing argument 1 of ‘load_nls’ discards ‘const’ qualifier from
pointer target type [-Wdiscarded-qualifiers]
2293 | ses->local_nls = load_nls(ctx->local_nls->charset);
Hi Steve,
Sorry about the mistake I made. I updated the patch with a very small
change:
ses->local_nls = load_nls((char *)ctx->local_nls->charset);
I don't like this approach. Removing a const via casting is not
a good idea. It invites write faults or outright bugs down
the call stack.
Why is the charset not const itself?
Tom.
It works, but I'm not sure whether it's clean enough.
Perhaps I should make a change to load_nls() to take a const char *
instead of char *? If this make sense, I'll do it soon.
Find the updated patch as attachment.