Linux cryptographic layer development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dan Carpenter" <dan@pereq.eu>, "Lukas Wunner" <lukas@wunner.de>,
	"Ignat Korchagin" <ignat@linux.win>,
	"Herbert Xu" <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	"Joy Latten" <latten@austin.ibm.com>,
	"David Howells" <dhowells@redhat.com>,
	"Robbie Harwood" <rharwood@redhat.com>,
	"Vivek Goyal" <vgoyal@redhat.com>
Cc: "Karthik Bhargavan" <karthik@pereq.eu>,
	"Clément Blaudeau" <clement@cryspen.com>,
	linux-crypto@vger.kernel.org, keyrings@vger.kernel.org
Subject: Re: [PATCH 4/4] crypto: asymmetric_keys - Print the correct offset in a debug message
Date: Fri, 04 Dec 2026 08:52:20 +0000	[thread overview]
Message-ID: <sashiko-outbox-249439@kernel.org> (raw)
In-Reply-To: <20261204-crypto_trivial-v1-4-9e0865f6d9ff@pereq.eu>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] crypto: off-by-hdrlen debug offset in pkcs7_extract_cert()
--

commit f0faf0419a12880593a89a85374f99bb1edc3463
Author: Dan Carpenter <dan@pereq.eu>

crypto: asymmetric_keys - Print the correct offset in a debug message

This commit updates a pr_debug() call in pkcs7_extract_cert() to compute
the logged offset from value instead of ctx.

> diff --git a/crypto/asymmetric_keys/pkcs7_parser.c b/crypto/asymmetric_keys/pkcs7_parser.c
> index 7f00e45a33cf6..c5dd638a50fe4 100644
> --- a/crypto/asymmetric_keys/pkcs7_parser.c
> +++ b/crypto/asymmetric_keys/pkcs7_parser.c
> @@ -445,7 +445,7 @@ int pkcs7_extract_cert(void *context, size_t hdrlen,
>  
>  	if (tag != ((ASN1_UNIV << 6) | ASN1_CONS_BIT | ASN1_SEQ)) {
>  		pr_debug("Cert began with tag %02x at %lu\n",
> -			 tag, (unsigned long)ctx - ctx->data);
> +			 tag, (unsigned long)value - ctx->data);
>  		return -EBADMSG;
>  	}

[Severity: Low]
Should this subtract hdrlen from value when computing the offset?

asn1_ber_decoder() advances past the tag and length header before invoking
the action, so value points to the payload rather than the tag byte, as
shown right below where value is adjusted by hdrlen for x509_cert_parse().
The debug message therefore logs an offset hdrlen bytes past the tag.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204-crypto_trivial-v1-0-9e0865f6d9ff@pereq.eu?part=4

      reply	other threads:[~2026-12-04  8:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  8:37 [PATCH 0/4] crypto: miscellaneous small fixes Dan Carpenter
2026-12-04  8:37 ` [PATCH 1/4] crypto: rsassa-pkcs1 - Fix check for no hash prefix Dan Carpenter
2026-12-04  8:37 ` [PATCH 2/4] crypto: ccm - Fix off-by-one in set_msg_len() Dan Carpenter
2026-12-04  8:37 ` [PATCH 3/4] crypto: asymmetric_keys - Fix warning in pefile_strip_sig_wrapper() Dan Carpenter
2026-12-04  8:37 ` [PATCH 4/4] crypto: asymmetric_keys - Print the correct offset in a debug message Dan Carpenter
2026-12-04  8:52   ` sashiko-bot [this message]

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=sashiko-outbox-249439@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=clement@cryspen.com \
    --cc=dan@pereq.eu \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=ignat@linux.win \
    --cc=karthik@pereq.eu \
    --cc=keyrings@vger.kernel.org \
    --cc=latten@austin.ibm.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=rharwood@redhat.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vgoyal@redhat.com \
    /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