lkml.org 
[lkml]   [2023]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH AUTOSEL 6.1 06/15] cifs: fix sockaddr comparison in iface_cmp
Hi!

> +++ b/fs/cifs/connect.c
> @@ -1332,6 +1332,56 @@ cifs_demultiplex_thread(void *p)
> module_put_and_kthread_exit(0);
> }
>
> +++ b/fs/cifs/smb2ops.c
> @@ -510,6 +510,43 @@ smb3_negotiate_rsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)
> return rsize;
> }
>
> +/*
> + * compare two interfaces a and b
> + * return 0 if everything matches.
> + * return 1 if a is rdma capable, or rss capable, or has higher link speed
> + * return -1 otherwise.
> + */
> +static int
> +iface_cmp(struct cifs_server_iface *a, struct cifs_server_iface *b)
> +{
> + int cmp_ret = 0;
> +
> + WARN_ON(!a || !b);
> + if (a->rdma_capable == b->rdma_capable) {
> + if (a->rss_capable == b->rss_capable) {
> + if (a->speed == b->speed) {
> + cmp_ret = cifs_ipaddr_cmp((struct sockaddr *) &a->sockaddr,
> + (struct sockaddr *) &b->sockaddr);
> + if (!cmp_ret)
> + return 0;
> + else if (cmp_ret > 0)
> + return 1;
> + else
> + return -1;

cifs_ipaddr_cmp already returns 0/1/-1, so this can really be "return cmp_ret".

Best regards,
Pavel
--
People of Russia, stop Putin before his war on Ukraine escalates.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2023-07-11 22:50    [W:0.079 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site