public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@sgi.com>
To: linux-ia64@vger.kernel.org
Subject: Re: salinfo incorrectly returning -ENOMEM
Date: Fri, 27 Jan 2006 22:45:08 +0000	[thread overview]
Message-ID: <43DAA274.7050901@sgi.com> (raw)
In-Reply-To: <1138400466.19287.24.camel@krebs.dannf>

[-- Attachment #1: Type: text/plain, Size: 971 bytes --]

dann frazier wrote:
> salinfo_decode will silently exit occasionally due to a failed open
> of /proc/sal/XXX/data.  This is because the kernel is returning -ENOMEM
> after attempting to vmalloc a buffer of size  
> ia64_sal_get_state_info_size(data->type).
> 
> However, on my system ia64_sal_get_state_info_size is returning 0, in
> which case I'd think a NULL vmalloc() result is correct.  
> 
> This patch assumes, of course, that 0 is a reasonable return value from
> ia64_sal_get_state_info_size().
> 

I'm working on fixing this up ...

The issue here is that ia64_sal_get_state_info_size is not doing any 
test on ia64_sal_retval.status other than to return 0.  0 is a 
reasonable return on an error, but :) as you noted the caller better be 
watching for it.

Dann, this patch will at least tell you what that return value is and 
might a) indicate a bigger bug, or b) indicate what's wrong with your 
platform ;).

(Patch is against Tony's latest tree)

P.

> 


[-- Attachment #2: dann.patch --]
[-- Type: text/plain, Size: 489 bytes --]

diff --git a/include/asm-ia64/sal.h b/include/asm-ia64/sal.h
--- a/include/asm-ia64/sal.h
+++ b/include/asm-ia64/sal.h
@@ -700,8 +700,11 @@ ia64_sal_get_state_info (u64 sal_info_ty
 	struct ia64_sal_retval isrv;
 	SAL_CALL_REENTRANT(isrv, SAL_GET_STATE_INFO, sal_info_type, 0,
 	              sal_info, 0, 0, 0, 0);
-	if (isrv.status)
+	if (isrv.status) {
+		printk("ia64_sal_get_state_info failed: %s\n",
+		       ia64_sal_strerror(isrv.status));
 		return 0;
+	}
 
 	return isrv.v0;
 }

  reply	other threads:[~2006-01-27 22:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-27 22:21 salinfo incorrectly returning -ENOMEM dann frazier
2006-01-27 22:45 ` Prarit Bhargava [this message]
2006-01-27 23:24 ` dann frazier
2006-01-28  0:07 ` Keith Owens
2006-02-08 17:52 ` dann frazier

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=43DAA274.7050901@sgi.com \
    --to=prarit@sgi.com \
    --cc=linux-ia64@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox