* [PATCH] scsi: iscsi_tcp: Explicitly cast param in iscsi_sw_tcp_host_get_param
@ 2018-10-04 1:06 Nathan Chancellor
2018-10-05 21:20 ` Nick Desaulniers
0 siblings, 1 reply; 2+ messages in thread
From: Nathan Chancellor @ 2018-10-04 1:06 UTC (permalink / raw)
To: Lee Duncan, Chris Leech, James E.J. Bottomley, Martin K. Petersen
Cc: open-iscsi, linux-scsi, linux-kernel, Nick Desaulniers,
Nathan Chancellor
Clang warns when one enumerated type is implicitly converted to another.
drivers/scsi/iscsi_tcp.c:803:15: warning: implicit conversion from
enumeration type 'enum iscsi_host_param' to different enumeration type
'enum iscsi_param' [-Wenum-conversion]
&addr, param, buf);
^~~~~
1 warning generated.
iscsi_conn_get_addr_param handles ISCSI_HOST_PARAM_IPADDRESS just fine
so add an explicit cast to iscsi_param to make it clear to Clang that
this is expected behavior.
Link: https://github.com/ClangBuiltLinux/linux/issues/153
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
drivers/scsi/iscsi_tcp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index b025a0b74341..23354f206533 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -800,7 +800,8 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost,
return rc;
return iscsi_conn_get_addr_param((struct sockaddr_storage *)
- &addr, param, buf);
+ &addr,
+ (enum iscsi_param)param, buf);
default:
return iscsi_host_get_param(shost, param, buf);
}
--
2.19.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] scsi: iscsi_tcp: Explicitly cast param in iscsi_sw_tcp_host_get_param
2018-10-04 1:06 [PATCH] scsi: iscsi_tcp: Explicitly cast param in iscsi_sw_tcp_host_get_param Nathan Chancellor
@ 2018-10-05 21:20 ` Nick Desaulniers
0 siblings, 0 replies; 2+ messages in thread
From: Nick Desaulniers @ 2018-10-05 21:20 UTC (permalink / raw)
To: Nathan Chancellor
Cc: lduncan, cleech, James E.J. Bottomley, Martin K. Petersen,
open-iscsi, linux-scsi, LKML
On Wed, Oct 3, 2018 at 6:06 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> Clang warns when one enumerated type is implicitly converted to another.
>
> drivers/scsi/iscsi_tcp.c:803:15: warning: implicit conversion from
> enumeration type 'enum iscsi_host_param' to different enumeration type
> 'enum iscsi_param' [-Wenum-conversion]
> &addr, param, buf);
> ^~~~~
> 1 warning generated.
>
> iscsi_conn_get_addr_param handles ISCSI_HOST_PARAM_IPADDRESS just fine
> so add an explicit cast to iscsi_param to make it clear to Clang that
> this is expected behavior.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/153
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> drivers/scsi/iscsi_tcp.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
> index b025a0b74341..23354f206533 100644
> --- a/drivers/scsi/iscsi_tcp.c
> +++ b/drivers/scsi/iscsi_tcp.c
> @@ -800,7 +800,8 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost,
> return rc;
>
> return iscsi_conn_get_addr_param((struct sockaddr_storage *)
> - &addr, param, buf);
> + &addr,
> + (enum iscsi_param)param, buf);
Alternatively, you could also just pass ISCSI_HOST_PARAM_IPADDRESS in
place of the cast (since in this case param ==
ISCSI_HOST_PARAM_IPADDRESS), but I don't feel strongly about this
(maybe the maintainers do).
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> default:
> return iscsi_host_get_param(shost, param, buf);
> }
> --
> 2.19.0
>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-05 21:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-04 1:06 [PATCH] scsi: iscsi_tcp: Explicitly cast param in iscsi_sw_tcp_host_get_param Nathan Chancellor
2018-10-05 21:20 ` Nick Desaulniers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).