mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Raja R Harinath <harinath@cs.umn.edu>
To: Petr Vandrovec <vandrove@vc.cvut.cz>
Cc: "Adam J. Richter" <adam@yggdrasil.com>,
	alsa-devel@alsa-project.org, perex@suse.cz,
	linux-kernel@vger.kernel.org
Subject: Re: Patch?: linux-2.5.59/sound/soundcore.c referenced non-existant errno variable
Date: Sat, 18 Jan 2003 09:40:36 -0600	[thread overview]
Message-ID: <d9bs2e8o0b.fsf@bose.cs.umn.edu> (raw)
In-Reply-To: <20030118031319.GA19982@vana.vc.cvut.cz> (Petr Vandrovec's message of "Sat, 18 Jan 2003 04:13:19 +0100")

Hi,

Petr Vandrovec <vandrove@vc.cvut.cz> writes:

> On Fri, Jan 17, 2003 at 08:49:36PM -0600, Raja R Harinath wrote:
>> Hi,
>> 
>> "Adam J. Richter" <adam@yggdrasil.com> writes:
>> 
>> > 	linux-2.5.59/sound/sound_firmware.c attempts to use the
>> > user level system call interface from the kernel, which I understand
>> > works on i386 and perhaps all architectures, but requires a variable
>> > named "errno." 
>> 
>> Which is provided in-kernel (not for modules) by 'lib/errno.c'.
>
> Not safe. We should either remove errno from kernel syscall wrappers 
> completely when building __KERNEL__ (just return -1 and nothing more
> specific), or even disallow use of unistd.h wrappers from kernel 
> completely (which is best solution IMHO). 

__KERNEL_SYSCALLS__ appears to be defined in several files.  Don't
know if they actually use any of them.

> BTW, static int errno is by far best solution if you do not agree with
> patch below: due to toolchain behavior soundcore will use its own
> errno for syscall wrappers it uses, and it is nearest to the behavior
> we wanted...
[snip]
>  static int do_mod_firmware_load(const char *fn, char **fp)
>  {
> -	int fd;
> +	struct file* filp;
>  	long l;
>  	char *dp;
> +	loff_t pos;
>
> -	fd = open(fn, 0, 0);
> -	if (fd == -1)
> +	filp = filp_open(fn, 0, 0);
> +	if (IS_ERR(filp))
>  	{
>  		printk(KERN_INFO "Unable to load '%s'.\n", fn);
>  		return 0;
>  	}
[snip]

I noticed that do_mod_firmware_load is wrapped by a
set_fs(get_gs())/set_fs(fs) pair in mod_firmware_load, presumably
because it performs an 'int 0x80' kernel syscall in there.  The
cleanup to use the VFS directly should probably kill the wrapper too.

- Hari
-- 
Raja R Harinath ------------------------------ harinath@cs.umn.edu

  reply	other threads:[~2003-01-18 15:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-17 23:57 Adam J. Richter
2003-01-18  2:49 ` Raja R Harinath
2003-01-18  3:13   ` Petr Vandrovec
2003-01-18 15:40     ` Raja R Harinath [this message]
2003-01-18 20:27       ` Petr Vandrovec
2003-01-18 20:40         ` Andrew Morton
2003-01-19  4:14 Adam J. Richter
2003-01-20 15:27 ` Horst von Brand
2003-01-21 16:48   ` Bill Davidsen
2003-01-21 17:01     ` Horst von Brand
2003-01-20 19:53 Adam J. Richter
2003-01-21  8:35 ` Horst von Brand
2003-01-20 20:01 Adam J. Richter

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=d9bs2e8o0b.fsf@bose.cs.umn.edu \
    --to=harinath@cs.umn.edu \
    --cc=adam@yggdrasil.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@suse.cz \
    --cc=vandrove@vc.cvut.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

Powered by JetHome