> Fix it by sg_next() on calculation of src/dst scatterlist.

Wording adjustment:
… by calling the function “sg_next” …


…
> +++ b/drivers/crypto/virtio/virtio_crypto_algs.c
> @@ -350,13 +350,18 @@ __virtio_crypto_skcipher_do_req(struct 
> virtio_crypto_sym_request *vc_sym_req,
…
>       src_nents = sg_nents_for_len(req->src, req->cryptlen);
> +     if (src_nents < 0) {
> +             pr_err("Invalid number of src SG.\n");
> +             return src_nents;
> +     }
> +
>       dst_nents = sg_nents(req->dst);
…

I suggest to move the addition of such input parameter validation
to a separate update step.

Regards,
Markus
  • [PATCH v2 0/2]... Longpeng(Mike)
    • [PATCH v2... Longpeng(Mike)
      • Re: [... Markus Elfring
        • R... Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
          • ... Markus Elfring
      • Re: [... Sasha Levin
    • [PATCH v2... Longpeng(Mike)
      • Re: [... Markus Elfring
        • R... Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
          • ... Markus Elfring
            • ... Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
              • ... Markus Elfring
              • ... Greg KH

Reply via email to