Linux PCI subsystem development
 help / color / mirror / Atom feed
From: "Jules Maselbas" <jmaselbas@zdiv.net>
To: "Martin Mareš" <mj@ucw.cz>
Cc: <linux-pci@vger.kernel.org>
Subject: Re: [RESEND PATCH] libpci: sysfs: Fix segmentation fault by including libgen.h
Date: Mon, 27 May 2024 14:45:11 +0200	[thread overview]
Message-ID: <D1KFQMUBKQTH.3NO3NAP5V39ZY@zdiv.net> (raw)
In-Reply-To: <mj+md-20240527.123235.12093.nikam@ucw.cz>

On Mon May 27, 2024 at 2:33 PM CEST, Martin Mareš wrote:
> Hello!
>
> > On a musl-based system (Alpine-linux) the basename(3) function is not defined
> > by including string.h with _GNU_SOURCE defined. However basename(3) could be
> > defined by including libgen.h.
> > 
> > On musl this is a problem than can lead to a segmentation fault, as I have
> > experienced. This issue is caused by basename(3) function being implicitly
> > declared and thus having, implicitly, a return type of int. Which in my case
> > caused an erroneous sign extension of a pointer leading to a segmentation
> > fault.
> > 
> > Adding an include for libgen.h sound to me like a proper solution.
> > Also by doing so the `_GNU_SOURCE` defined is no longer needed.
>
> It should be fixed by commit 89cb2ae87236604b0e8ededd0fd7d9425c2d8cb6.
>
> Could you please check if it works for you?
nitpick / for the record:
it previously compiled with musl, gcc (13) only generated a warning,
but it should nolonger compile with gcc 14, as the warning is now an error.


      parent reply	other threads:[~2024-05-27 12:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-21  8:05 [RESEND PATCH] libpci: sysfs: Fix segmentation fault by including libgen.h Jules Maselbas
2024-05-27 12:33 ` Martin Mareš
2024-05-27 12:37   ` Jules Maselbas
2024-05-27 12:45   ` Jules Maselbas [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=D1KFQMUBKQTH.3NO3NAP5V39ZY@zdiv.net \
    --to=jmaselbas@zdiv.net \
    --cc=linux-pci@vger.kernel.org \
    --cc=mj@ucw.cz \
    /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