From: Hannes Reinecke <hare@suse.com>
To: target-devel@vger.kernel.org
Subject: Re: [PATCH 06/11] target/iscsi: Use min() in iscsit_dump_data_payload() instead of open-coding it
Date: Thu, 02 Nov 2017 14:00:19 +0000 [thread overview]
Message-ID: <6365cd76-dbb2-a9a9-95d1-6095120770ca@suse.com> (raw)
On 10/31/2017 07:03 PM, Bart Van Assche wrote:
> This patch does not change any functionality.
>
> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Nicholas Bellinger <nab@linux-iscsi.org>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Hannes Reinecke <hare@suse.com>
> Cc: Mike Christie <mchristi@redhat.com>
> ---
> drivers/target/iscsi/iscsi_target_erl1.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c
> index fe9b7f1e44ac..659efafb43ec 100644
> --- a/drivers/target/iscsi/iscsi_target_erl1.c
> +++ b/drivers/target/iscsi/iscsi_target_erl1.c
> @@ -34,7 +34,7 @@
> #include "iscsi_target_erl2.h"
> #include "iscsi_target.h"
>
> -#define OFFLOAD_BUF_SIZE 32768
> +#define OFFLOAD_BUF_SIZE 32768U
>
> /*
> * Used to dump excess datain payload for certain error recovery
> @@ -56,7 +56,7 @@ int iscsit_dump_data_payload(
> if (conn->sess->sess_ops->RDMAExtensions)
> return 0;
>
> - length = (buf_len > OFFLOAD_BUF_SIZE) ? OFFLOAD_BUF_SIZE : buf_len;
> + length = min(buf_len, OFFLOAD_BUF_SIZE);
>
> buf = kzalloc(length, GFP_ATOMIC);
> if (!buf) {
> @@ -67,8 +67,7 @@ int iscsit_dump_data_payload(
> memset(&iov, 0, sizeof(struct kvec));
>
> while (offset < buf_len) {
> - size = ((offset + length) > buf_len) ?
> - (buf_len - offset) : length;
> + size = min(buf_len - offset, length);
>
> iov.iov_len = size;
> iov.iov_base = buf;
>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.com +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
next reply other threads:[~2017-11-02 14:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-02 14:00 Hannes Reinecke [this message]
-- strict thread matches above, loose matches on Subject: below --
2017-10-31 18:03 [PATCH 06/11] target/iscsi: Use min() in iscsit_dump_data_payload() instead of open-coding it Bart Van Assche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6365cd76-dbb2-a9a9-95d1-6095120770ca@suse.com \
--to=hare@suse.com \
--cc=target-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).