Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 375558
b: refs/heads/master
c: a94a147
h: refs/heads/master
v: v3
  • Loading branch information
Vasant Hegde authored and Benjamin Herrenschmidt committed May 14, 2013
1 parent b3c3c1c commit 2d55ade
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 79c66ce8f6448a3295a32efeac88c9debd7f7094
refs/heads/master: a94a14720eaf55c5f06d6ca7ecbe3f87f6864fc6
10 changes: 6 additions & 4 deletions trunk/arch/powerpc/kernel/rtas_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@

/* Array sizes */
#define VALIDATE_BUF_SIZE 4096
#define VALIDATE_MSG_LEN 256
#define RTAS_MSG_MAXLEN 64

/* Quirk - RTAS requires 4k list length and block size */
Expand Down Expand Up @@ -466,15 +467,16 @@ static void validate_flash(struct rtas_validate_flash_t *args_buf)
}

static int get_validate_flash_msg(struct rtas_validate_flash_t *args_buf,
char *msg)
char *msg, int msglen)
{
int n;

if (args_buf->status >= VALIDATE_TMP_UPDATE) {
n = sprintf(msg, "%d\n", args_buf->update_results);
if ((args_buf->update_results >= VALIDATE_CUR_UNKNOWN) ||
(args_buf->update_results == VALIDATE_TMP_UPDATE))
n += sprintf(msg + n, "%s\n", args_buf->buf);
n += snprintf(msg + n, msglen - n, "%s\n",
args_buf->buf);
} else {
n = sprintf(msg, "%d\n", args_buf->status);
}
Expand All @@ -486,11 +488,11 @@ static ssize_t validate_flash_read(struct file *file, char __user *buf,
{
struct rtas_validate_flash_t *const args_buf =
&rtas_validate_flash_data;
char msg[RTAS_MSG_MAXLEN];
char msg[VALIDATE_MSG_LEN];
int msglen;

mutex_lock(&rtas_validate_flash_mutex);
msglen = get_validate_flash_msg(args_buf, msg);
msglen = get_validate_flash_msg(args_buf, msg, VALIDATE_MSG_LEN);
mutex_unlock(&rtas_validate_flash_mutex);

return simple_read_from_buffer(buf, count, ppos, msg, msglen);
Expand Down

0 comments on commit 2d55ade

Please sign in to comment.