All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: luzmaximilian@gmail.com
Cc: platform-driver-x86@vger.kernel.org
Subject: [bug report] platform/surface: Add Surface Aggregator subsystem
Date: Mon, 25 Jan 2021 14:42:31 +0300	[thread overview]
Message-ID: <YA6up/PbuEZ82kNd@mwanda> (raw)

Hello Maximilian Luz,

The patch c167b9c7e3d6: "platform/surface: Add Surface Aggregator
subsystem" from Dec 21, 2020, leads to the following static checker
warning:

	drivers/platform/surface/aggregator/ssh_packet_layer.c:1697 ssh_ptl_rx_eval()
	warn: check likely/unlikely parens

drivers/platform/surface/aggregator/ssh_packet_layer.c
  1683  static size_t ssh_ptl_rx_eval(struct ssh_ptl *ptl, struct ssam_span *source)
  1684  {
  1685          struct ssh_frame *frame;
  1686          struct ssam_span payload;
  1687          struct ssam_span aligned;
  1688          bool syn_found;
  1689          int status;
  1690  
  1691          /* Error injection: Modify data to simulate corrupt SYN bytes. */
  1692          ssh_ptl_rx_inject_invalid_syn(ptl, source);
  1693  
  1694          /* Find SYN. */
  1695          syn_found = sshp_find_syn(source, &aligned);
  1696  
  1697          if (unlikely(aligned.ptr - source->ptr) > 0) {

The unlikely() macro returns 0/1.  Smatch is suggesting that this should
just be "if (unlikely((aligned.ptr - source->ptr) > 0)) {" but I'm not
at all sure that that's correct.  Isn't aligned being higher than source
the normal case?

  1698                  ptl_warn(ptl, "rx: parser: invalid start of frame, skipping\n");
  1699  
  1700                  /*
  1701                   * Notes:
  1702                   * - This might send multiple NAKs in case the communication

regards,
dan carpenter

             reply	other threads:[~2021-01-26  5:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25 11:42 Dan Carpenter [this message]
2021-01-25 12:12 ` [bug report] platform/surface: Add Surface Aggregator subsystem Maximilian Luz
2021-01-26 10:11   ` Dan Carpenter
2021-01-26 15:45     ` Maximilian Luz

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=YA6up/PbuEZ82kNd@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=luzmaximilian@gmail.com \
    --cc=platform-driver-x86@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.