All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Ricardo Cerqueira <ricardo@cerqueira.org>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: (Was Re: [Alsa-user] Poorly supported HDA intel)
Date: Mon, 23 Oct 2006 13:12:21 +0200	[thread overview]
Message-ID: <s5hk62r1e22.wl%tiwai@suse.de> (raw)
In-Reply-To: <08893603f9fbf36bdfc7189f5ae6d856@192.168.1.254>

At Fri, 20 Oct 2006 19:16:19 +0200,
Ricardo Cerqueira wrote:
> 
> On Fri, 20 Oct 2006 18:55:56 +0200, Ricardo Cerqueira <alsa-users@cerqueira.org> wrote:
> > 
> > On Fri, 20 Oct 2006 18:48:13 +0200, Takashi Iwai <tiwai@suse.de> wrote:
> >> At Fri, 20 Oct 2006 18:35:43 +0200,
> >> Ricardo Cerqueira wrote:
> >>>
> >>>
> >>>
> >>> On Fri, 20 Oct 2006 18:18:09 +0200, Takashi Iwai <tiwai@suse.de> wrote:
> >>> > At Fri, 20 Oct 2006 17:55:23 +0200,
> >>> > Ricardo Cerqueira wrote:
> >>> >>
> >>> >> On Fri, 20 Oct 2006 17:52:56 +0200, Takashi Iwai <tiwai@suse.de>
> >> wrote:
> >>> >> > At Fri, 20 Oct 2006 17:48:00 +0200,
> >>> >>
> >>> >> >>
> >>> >> >> Hmmm. I was trying to look into codec#0 to check the pin
> >> assignments,
> >>> >> > and I
> >>> >> >> realized it's being cut off at byte 4096, and I'm missing
> >>> > information.
> >>> >> > Looks
> >>> >> >> like something is limiting that proc entry's size to 4k, do you
> >> have
> >>> > any
> >>> >> > idea
> >>> >> >> where?
> >>> >> >
> >>> >> > Are your using HG version of driver?
> >>> >> > This bug should have been fixed recently.
> >>> >> >
> >>> >> >
> >>> >>
> >>> >> Yes, pulled about 14 hours ago...
> >>> >
> >>> > Strange, it works for me.  I tested to print extra data up to 32k
> >>> > bytes on my i386 machine, and it looks OK.
> >>> >
> >>> > Check alsa-kernel hg tree whether you have a changeset 4658
> >>> > "Fix re-use of va_list" (although it should work even without this
> >>> > patch on i386).
> >>>
> >>> Yes, I'm at changeset 4662... I checked core/info.c by hand, and the
> >> va_list
> >>> change is there... I just tried cloning fresh copies of alsa-kernel and
> >>> alsa-driver, and the result is the same.
> >>
> >> Weird.  Could you check whether really it's 4k boundary problem?
> > 
> > Looks like it is:
> 
> OK... The resize call is never reached (the break clause is always true).
> I added a small printk before the size test, and got:
> 
> DEBUG - res=48 and len=74
> DEBUG - res=25 and len=26
> DEBUG - res=0 and len=1
> DEBUG - res=0 and len=1
> DEBUG - res=0 and len=1
> 
> And from here on, vsnprintf always returns 0.

> From my understanding of
> the documentation, it shouldn't happen, but... (maybe a glibc bug?)

Unless you call like vsnprintf(buf, len, "").  But I don't think it's
this case.

The kernel code uses its own implementation of vsnprintf(), so it
should be a bug of kernel.

Which version of kernel and gcc are you using?  It has worked fine
with my machines, 2.6.18, 19-git and gcc 4.1.

> Changing the "if (res < len)" to "if (res && res < len)" solves it, but I
> don't know if there'll be other side effects.

We should check whether fmt is an empty string.  Otherwise
res must return a positive value, so it should be OK.
The patch is below.


Takashi

diff -r d7fe584f7395 core/info.c
--- a/core/info.c	Thu Oct 19 20:35:56 2006 +0200
+++ b/core/info.c	Mon Oct 23 13:06:05 2006 +0200
@@ -117,6 +117,8 @@ int snd_iprintf(struct snd_info_buffer *
 	might_sleep();
 	if (buffer->stop || buffer->error)
 		return 0;
+	if (!*fmt)
+		return 0;
 	len = buffer->len - buffer->size;
 	va_start(args, fmt);
 	for (;;) {
@@ -124,7 +126,7 @@ int snd_iprintf(struct snd_info_buffer *
 		va_copy(ap, args);
 		res = vsnprintf(buffer->buffer + buffer->curr, len, fmt, ap);
 		va_end(ap);
-		if (res < len)
+		if (res && res < len)
 			break;
 		err = resize_info_buffer(buffer, buffer->len + PAGE_SIZE);
 		if (err < 0)

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

  reply	other threads:[~2006-10-23 11:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <s5h64ef2gu3.wl%tiwai@suse.de>
     [not found] ` <d216214ec4416bdd3239c871772e9cc4@192.168.1.254>
2006-10-20 15:14   ` [Alsa-user] Poorly supported HDA intel Takashi Iwai
2006-10-20 15:24     ` Ricardo Cerqueira
2006-10-20 15:48     ` Ricardo Cerqueira
2006-10-20 15:52       ` Takashi Iwai
2006-10-20 15:55         ` Ricardo Cerqueira
2006-10-20 16:18           ` Takashi Iwai
2006-10-20 16:35             ` Ricardo Cerqueira
2006-10-20 16:48               ` (Was Re: [Alsa-user] Poorly supported HDA intel) Takashi Iwai
2006-10-20 16:55                 ` Ricardo Cerqueira
2006-10-20 17:16                   ` Ricardo Cerqueira
2006-10-23 11:12                     ` Takashi Iwai [this message]
2006-10-23 11:36                       ` Takashi Iwai
2006-10-29 11:45                         ` Ricardo Cerqueira
2006-10-24 19:08                     ` (no subject) Thierry Vignaud

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=s5hk62r1e22.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=ricardo@cerqueira.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.