Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdb driver error when transfer buffer size big than 16M #2

Open
ugxmg opened this issue Dec 29, 2020 · 0 comments
Open

sdb driver error when transfer buffer size big than 16M #2

ugxmg opened this issue Dec 29, 2020 · 0 comments

Comments

@ugxmg
Copy link

ugxmg commented Dec 29, 2020

strsep will change value of rxbuf_str

so, the right is below

static long rpmsg_sdb_decode_rxbuf_string(char *rxbuf_str, int *buffer_id, size_t *size)
{
int ret = 0;
char *sub_str;
long bsize;
long bufid;
const char delimiter[1] = {'L'};

//pr_err("%s: rxbuf_str:%s\n", __func__, rxbuf_str);

/* Get first part containing the buffer id */
sub_str = strsep(&rxbuf_str, delimiter);

//pr_err("%s: sub_str:%s\n", __func__, sub_str);

/* Save Buffer id and size: template BxLyyyyyyyy*/
ret = kstrtol(&sub_str[1], 10, &bufid);
if (ret < 0) {
	pr_err("%s: extract of buffer id failed(%d)", __func__, ret);
	goto out;
}

ret = kstrtol(rxbuf_str, 16, &bsize);
if (ret < 0) {
	pr_err("%s: extract of buffer size failed(%d)", __func__, ret);
	goto out;
}

*size = (size_t)bsize;
*buffer_id = (int)bufid;

out:
return ret;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant