{"action":"created","issue":{"url":"https://api.github.com/repos/daniel-santos/mcp2210-linux/issues/35","repository_url":"https://api.github.com/repos/daniel-santos/mcp2210-linux","labels_url":"https://api.github.com/repos/daniel-santos/mcp2210-linux/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/daniel-santos/mcp2210-linux/issues/35/comments","events_url":"https://api.github.com/repos/daniel-santos/mcp2210-linux/issues/35/events","html_url":"https://github.com/daniel-santos/mcp2210-linux/issues/35","id":342388916,"node_id":"MDU6SXNzdWUzNDIzODg5MTY=","number":35,"title":"kernel crashing in spi_submit_prepare","user":{"login":"tchen61","id":35014859,"node_id":"MDQ6VXNlcjM1MDE0ODU5","avatar_url":"https://avatars2.githubusercontent.com/u/35014859?v=4","gravatar_id":"","url":"https://api.github.com/users/tchen61","html_url":"https://github.com/tchen61","followers_url":"https://api.github.com/users/tchen61/followers","following_url":"https://api.github.com/users/tchen61/following{/other_user}","gists_url":"https://api.github.com/users/tchen61/gists{/gist_id}","starred_url":"https://api.github.com/users/tchen61/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tchen61/subscriptions","organizations_url":"https://api.github.com/users/tchen61/orgs","repos_url":"https://api.github.com/users/tchen61/repos","events_url":"https://api.github.com/users/tchen61/events{/privacy}","received_events_url":"https://api.github.com/users/tchen61/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-18T15:50:29Z","updated_at":"2018-07-18T18:07:45Z","closed_at":null,"author_association":"NONE","body":"in cmp2210-core.c  submit_urbs, driver calls spi_submit_prepare with a pointer to\r\n(struct mcp2210_cmd *),\r\nbut in the spi_submit_prepare, it CASTs that pointer to (struct mcp2210_cmd_spi_msg *)\r\nand then subsequently tries to load up an element xfer....  \r\n\r\nand then later use xfer to access the tx_buf, and len....\r\n\r\nkernel crashes when tx_buf is NULL, but len is not....    \r\nnot sure if the casting of mcp2210_cmd  to mcp2210_cmd_spi_msg is correct\r\n"},"comment":{"url":"https://api.github.com/repos/daniel-santos/mcp2210-linux/issues/comments/406023310","html_url":"https://github.com/daniel-santos/mcp2210-linux/issues/35#issuecomment-406023310","issue_url":"https://api.github.com/repos/daniel-santos/mcp2210-linux/issues/35","id":406023310,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjAyMzMxMA==","user":{"login":"daniel-santos","id":980562,"node_id":"MDQ6VXNlcjk4MDU2Mg==","avatar_url":"https://avatars3.githubusercontent.com/u/980562?v=4","gravatar_id":"","url":"https://api.github.com/users/daniel-santos","html_url":"https://github.com/daniel-santos","followers_url":"https://api.github.com/users/daniel-santos/followers","following_url":"https://api.github.com/users/daniel-santos/following{/other_user}","gists_url":"https://api.github.com/users/daniel-santos/gists{/gist_id}","starred_url":"https://api.github.com/users/daniel-santos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daniel-santos/subscriptions","organizations_url":"https://api.github.com/users/daniel-santos/orgs","repos_url":"https://api.github.com/users/daniel-santos/repos","events_url":"https://api.github.com/users/daniel-santos/events{/privacy}","received_events_url":"https://api.github.com/users/daniel-santos/received_events","type":"User","site_admin":false},"created_at":"2018-07-18T18:07:45Z","updated_at":"2018-07-18T18:07:45Z","author_association":"OWNER","body":"Hello.  This cast is C polymorphism.  If you look at the definition of [struct mcp2210_cmd_spi_msg](https://github.com/daniel-santos/mcp2210-linux/blob/master/mcp2210.h#L803) you will see that it's first member is struct mcp2210_cmd head.  This is how you do polymorphism in C and you can think of them as classes.  The second field of the base class, [struct mcp2210_cmd](https://github.com/daniel-santos/mcp2210-linux/blob/master/mcp2210.h#L758) defines the subtype so it is never cast incorrectly (aside from memory corruption, incorrect code, etc.).\r\n\r\nBut if there's a NULL dereference then something is obviously wrong.  Post the stack trace."}}
{"actor":{"display_login":"daniel-santos"}}