Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper
Hi! > > >> I guess the initial mail somehow didn't make it through your spam filter: > > >> https://lkml.org/lkml/2013/12/1/70 > > > It did, but I thought that people asked for it to be changed in the > > > thread afterwards, so I was expecting an updated version from you. > > > > > > Care to fix things up and resend it? > > > > > > thanks, > > > > > > greg k-h > > > > Sure, the change I was asked for is trivial, but I didn't get the reason > > why it is needed. Neither there is a reply to my follow-up comment [0]. > > Sorry, I am pretty much new on LKML and could miss things that are > > supposed to be clear from the start, but my impression is that when > > someone says "it is better", he/she should explain why it is better or > > at least what is wrong with the patch he/she wants to be changed. > > > > However, I don't want to enter some arguing loop, so if you think I > > should change the code as per Joe's comment, just confirm it and I'll do it. > > Please try. Not checking sscanf() return is un-nice, so yes, it would be nice to fix it, even if it will not happen in practice. 0 / -EINVAL is acceptable return value. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper
Hi! I guess the initial mail somehow didn't make it through your spam filter: https://lkml.org/lkml/2013/12/1/70 It did, but I thought that people asked for it to be changed in the thread afterwards, so I was expecting an updated version from you. Care to fix things up and resend it? thanks, greg k-h Sure, the change I was asked for is trivial, but I didn't get the reason why it is needed. Neither there is a reply to my follow-up comment [0]. Sorry, I am pretty much new on LKML and could miss things that are supposed to be clear from the start, but my impression is that when someone says it is better, he/she should explain why it is better or at least what is wrong with the patch he/she wants to be changed. However, I don't want to enter some arguing loop, so if you think I should change the code as per Joe's comment, just confirm it and I'll do it. Please try. Not checking sscanf() return is un-nice, so yes, it would be nice to fix it, even if it will not happen in practice. 0 / -EINVAL is acceptable return value. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper
On Sat, Dec 07, 2013 at 10:41:36AM +0200, Ivajlo Dimitrov wrote: > > On 06.12.2013 17:10, gre...@linuxfoundation.org wrote: > > On Fri, Dec 06, 2013 at 08:05:38AM +0200, Ivajlo Dimitrov wrote: > >> Hi Greg, > >> > >> On 01.12.2013 19:07, Ivaylo DImitrov wrote: > >>> From: Ivaylo Dimitrov > >>> > >>> Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't > >>> need to be exported. It can also be made way simpler by using sscanf. > >>> > >>> Signed-off-by: Ivaylo Dimitrov > >>> --- > >>>drivers/staging/tidspbridge/Makefile |2 +- > >>>drivers/staging/tidspbridge/gen/uuidutil.c | 85 > >>> > >>>.../tidspbridge/include/dspbridge/uuidutil.h | 18 > >>>drivers/staging/tidspbridge/rmgr/dbdcd.c | 42 +- > >>>4 files changed, 39 insertions(+), 108 deletions(-) > >>>delete mode 100644 drivers/staging/tidspbridge/gen/uuidutil.c > >>> > >> I guess the initial mail somehow didn't make it through your spam filter: > >> https://lkml.org/lkml/2013/12/1/70 > > It did, but I thought that people asked for it to be changed in the > > thread afterwards, so I was expecting an updated version from you. > > > > Care to fix things up and resend it? > > > > thanks, > > > > greg k-h > > Sure, the change I was asked for is trivial, but I didn't get the reason > why it is needed. Neither there is a reply to my follow-up comment [0]. > Sorry, I am pretty much new on LKML and could miss things that are > supposed to be clear from the start, but my impression is that when > someone says "it is better", he/she should explain why it is better or > at least what is wrong with the patch he/she wants to be changed. > > However, I don't want to enter some arguing loop, so if you think I > should change the code as per Joe's comment, just confirm it and I'll do it. Please try. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper
On 06.12.2013 17:10, gre...@linuxfoundation.org wrote: On Fri, Dec 06, 2013 at 08:05:38AM +0200, Ivajlo Dimitrov wrote: Hi Greg, On 01.12.2013 19:07, Ivaylo DImitrov wrote: From: Ivaylo Dimitrov Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't need to be exported. It can also be made way simpler by using sscanf. Signed-off-by: Ivaylo Dimitrov --- drivers/staging/tidspbridge/Makefile |2 +- drivers/staging/tidspbridge/gen/uuidutil.c | 85 .../tidspbridge/include/dspbridge/uuidutil.h | 18 drivers/staging/tidspbridge/rmgr/dbdcd.c | 42 +- 4 files changed, 39 insertions(+), 108 deletions(-) delete mode 100644 drivers/staging/tidspbridge/gen/uuidutil.c I guess the initial mail somehow didn't make it through your spam filter: https://lkml.org/lkml/2013/12/1/70 It did, but I thought that people asked for it to be changed in the thread afterwards, so I was expecting an updated version from you. Care to fix things up and resend it? thanks, greg k-h Sure, the change I was asked for is trivial, but I didn't get the reason why it is needed. Neither there is a reply to my follow-up comment [0]. Sorry, I am pretty much new on LKML and could miss things that are supposed to be clear from the start, but my impression is that when someone says "it is better", he/she should explain why it is better or at least what is wrong with the patch he/she wants to be changed. However, I don't want to enter some arguing loop, so if you think I should change the code as per Joe's comment, just confirm it and I'll do it. Thanks, Ivo [0] https://lkml.org/lkml/2013/12/1/113 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper
On 06.12.2013 17:10, gre...@linuxfoundation.org wrote: On Fri, Dec 06, 2013 at 08:05:38AM +0200, Ivajlo Dimitrov wrote: Hi Greg, On 01.12.2013 19:07, Ivaylo DImitrov wrote: From: Ivaylo Dimitrov freemangor...@abv.bg Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't need to be exported. It can also be made way simpler by using sscanf. Signed-off-by: Ivaylo Dimitrov freemangor...@abv.bg --- drivers/staging/tidspbridge/Makefile |2 +- drivers/staging/tidspbridge/gen/uuidutil.c | 85 .../tidspbridge/include/dspbridge/uuidutil.h | 18 drivers/staging/tidspbridge/rmgr/dbdcd.c | 42 +- 4 files changed, 39 insertions(+), 108 deletions(-) delete mode 100644 drivers/staging/tidspbridge/gen/uuidutil.c I guess the initial mail somehow didn't make it through your spam filter: https://lkml.org/lkml/2013/12/1/70 It did, but I thought that people asked for it to be changed in the thread afterwards, so I was expecting an updated version from you. Care to fix things up and resend it? thanks, greg k-h Sure, the change I was asked for is trivial, but I didn't get the reason why it is needed. Neither there is a reply to my follow-up comment [0]. Sorry, I am pretty much new on LKML and could miss things that are supposed to be clear from the start, but my impression is that when someone says it is better, he/she should explain why it is better or at least what is wrong with the patch he/she wants to be changed. However, I don't want to enter some arguing loop, so if you think I should change the code as per Joe's comment, just confirm it and I'll do it. Thanks, Ivo [0] https://lkml.org/lkml/2013/12/1/113 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper
On Sat, Dec 07, 2013 at 10:41:36AM +0200, Ivajlo Dimitrov wrote: On 06.12.2013 17:10, gre...@linuxfoundation.org wrote: On Fri, Dec 06, 2013 at 08:05:38AM +0200, Ivajlo Dimitrov wrote: Hi Greg, On 01.12.2013 19:07, Ivaylo DImitrov wrote: From: Ivaylo Dimitrov freemangor...@abv.bg Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't need to be exported. It can also be made way simpler by using sscanf. Signed-off-by: Ivaylo Dimitrov freemangor...@abv.bg --- drivers/staging/tidspbridge/Makefile |2 +- drivers/staging/tidspbridge/gen/uuidutil.c | 85 .../tidspbridge/include/dspbridge/uuidutil.h | 18 drivers/staging/tidspbridge/rmgr/dbdcd.c | 42 +- 4 files changed, 39 insertions(+), 108 deletions(-) delete mode 100644 drivers/staging/tidspbridge/gen/uuidutil.c I guess the initial mail somehow didn't make it through your spam filter: https://lkml.org/lkml/2013/12/1/70 It did, but I thought that people asked for it to be changed in the thread afterwards, so I was expecting an updated version from you. Care to fix things up and resend it? thanks, greg k-h Sure, the change I was asked for is trivial, but I didn't get the reason why it is needed. Neither there is a reply to my follow-up comment [0]. Sorry, I am pretty much new on LKML and could miss things that are supposed to be clear from the start, but my impression is that when someone says it is better, he/she should explain why it is better or at least what is wrong with the patch he/she wants to be changed. However, I don't want to enter some arguing loop, so if you think I should change the code as per Joe's comment, just confirm it and I'll do it. Please try. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper
On Fri, Dec 06, 2013 at 08:05:38AM +0200, Ivajlo Dimitrov wrote: > Hi Greg, > > On 01.12.2013 19:07, Ivaylo DImitrov wrote: > > From: Ivaylo Dimitrov > > > > Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't > > need to be exported. It can also be made way simpler by using sscanf. > > > > Signed-off-by: Ivaylo Dimitrov > > --- > > drivers/staging/tidspbridge/Makefile |2 +- > > drivers/staging/tidspbridge/gen/uuidutil.c | 85 > > > > .../tidspbridge/include/dspbridge/uuidutil.h | 18 > > drivers/staging/tidspbridge/rmgr/dbdcd.c | 42 +- > > 4 files changed, 39 insertions(+), 108 deletions(-) > > delete mode 100644 drivers/staging/tidspbridge/gen/uuidutil.c > > > > I guess the initial mail somehow didn't make it through your spam filter: > https://lkml.org/lkml/2013/12/1/70 It did, but I thought that people asked for it to be changed in the thread afterwards, so I was expecting an updated version from you. Care to fix things up and resend it? thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper
On Fri, Dec 06, 2013 at 08:05:38AM +0200, Ivajlo Dimitrov wrote: Hi Greg, On 01.12.2013 19:07, Ivaylo DImitrov wrote: From: Ivaylo Dimitrov freemangor...@abv.bg Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't need to be exported. It can also be made way simpler by using sscanf. Signed-off-by: Ivaylo Dimitrov freemangor...@abv.bg --- drivers/staging/tidspbridge/Makefile |2 +- drivers/staging/tidspbridge/gen/uuidutil.c | 85 .../tidspbridge/include/dspbridge/uuidutil.h | 18 drivers/staging/tidspbridge/rmgr/dbdcd.c | 42 +- 4 files changed, 39 insertions(+), 108 deletions(-) delete mode 100644 drivers/staging/tidspbridge/gen/uuidutil.c I guess the initial mail somehow didn't make it through your spam filter: https://lkml.org/lkml/2013/12/1/70 It did, but I thought that people asked for it to be changed in the thread afterwards, so I was expecting an updated version from you. Care to fix things up and resend it? thanks, greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper
My other patch (the one that fixes the security issue) was already applied, albeit it was sent after this one, see https://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/commit/?h=staging-linus=559c71fe5dc3bf2ecc55afb336145db7f0abf810 , that is why I think there is some problem with the mail itself. Sure I will wait :) regards, Ivo On 06.12.2013 09:32, Dan Carpenter wrote: On Fri, Dec 06, 2013 at 08:05:38AM +0200, Ivajlo Dimitrov wrote: Hi Greg, On 01.12.2013 19:07, Ivaylo DImitrov wrote: From: Ivaylo Dimitrov Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't need to be exported. It can also be made way simpler by using sscanf. Signed-off-by: Ivaylo Dimitrov --- drivers/staging/tidspbridge/Makefile |2 +- drivers/staging/tidspbridge/gen/uuidutil.c | 85 .../tidspbridge/include/dspbridge/uuidutil.h | 18 drivers/staging/tidspbridge/rmgr/dbdcd.c | 42 +- 4 files changed, 39 insertions(+), 108 deletions(-) delete mode 100644 drivers/staging/tidspbridge/gen/uuidutil.c I guess the initial mail somehow didn't make it through your spam filter: https://lkml.org/lkml/2013/12/1/70 It's too early to start resending. Wait for another week at least. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper
On Fri, Dec 06, 2013 at 08:05:38AM +0200, Ivajlo Dimitrov wrote: > Hi Greg, > > On 01.12.2013 19:07, Ivaylo DImitrov wrote: > >From: Ivaylo Dimitrov > > > >Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't > >need to be exported. It can also be made way simpler by using sscanf. > > > >Signed-off-by: Ivaylo Dimitrov > >--- > > drivers/staging/tidspbridge/Makefile |2 +- > > drivers/staging/tidspbridge/gen/uuidutil.c | 85 > > > > .../tidspbridge/include/dspbridge/uuidutil.h | 18 > > drivers/staging/tidspbridge/rmgr/dbdcd.c | 42 +- > > 4 files changed, 39 insertions(+), 108 deletions(-) > > delete mode 100644 drivers/staging/tidspbridge/gen/uuidutil.c > > > > I guess the initial mail somehow didn't make it through your spam filter: > https://lkml.org/lkml/2013/12/1/70 > It's too early to start resending. Wait for another week at least. regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper
Hi Greg, On 01.12.2013 19:07, Ivaylo DImitrov wrote: From: Ivaylo Dimitrov Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't need to be exported. It can also be made way simpler by using sscanf. Signed-off-by: Ivaylo Dimitrov --- drivers/staging/tidspbridge/Makefile |2 +- drivers/staging/tidspbridge/gen/uuidutil.c | 85 .../tidspbridge/include/dspbridge/uuidutil.h | 18 drivers/staging/tidspbridge/rmgr/dbdcd.c | 42 +- 4 files changed, 39 insertions(+), 108 deletions(-) delete mode 100644 drivers/staging/tidspbridge/gen/uuidutil.c I guess the initial mail somehow didn't make it through your spam filter: https://lkml.org/lkml/2013/12/1/70 Regards, Ivo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper
Hi Greg, On 01.12.2013 19:07, Ivaylo DImitrov wrote: From: Ivaylo Dimitrov freemangor...@abv.bg Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't need to be exported. It can also be made way simpler by using sscanf. Signed-off-by: Ivaylo Dimitrov freemangor...@abv.bg --- drivers/staging/tidspbridge/Makefile |2 +- drivers/staging/tidspbridge/gen/uuidutil.c | 85 .../tidspbridge/include/dspbridge/uuidutil.h | 18 drivers/staging/tidspbridge/rmgr/dbdcd.c | 42 +- 4 files changed, 39 insertions(+), 108 deletions(-) delete mode 100644 drivers/staging/tidspbridge/gen/uuidutil.c I guess the initial mail somehow didn't make it through your spam filter: https://lkml.org/lkml/2013/12/1/70 Regards, Ivo -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper
On Fri, Dec 06, 2013 at 08:05:38AM +0200, Ivajlo Dimitrov wrote: Hi Greg, On 01.12.2013 19:07, Ivaylo DImitrov wrote: From: Ivaylo Dimitrov freemangor...@abv.bg Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't need to be exported. It can also be made way simpler by using sscanf. Signed-off-by: Ivaylo Dimitrov freemangor...@abv.bg --- drivers/staging/tidspbridge/Makefile |2 +- drivers/staging/tidspbridge/gen/uuidutil.c | 85 .../tidspbridge/include/dspbridge/uuidutil.h | 18 drivers/staging/tidspbridge/rmgr/dbdcd.c | 42 +- 4 files changed, 39 insertions(+), 108 deletions(-) delete mode 100644 drivers/staging/tidspbridge/gen/uuidutil.c I guess the initial mail somehow didn't make it through your spam filter: https://lkml.org/lkml/2013/12/1/70 It's too early to start resending. Wait for another week at least. regards, dan carpenter -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper
My other patch (the one that fixes the security issue) was already applied, albeit it was sent after this one, see https://git.kernel.org/cgit/linux/kernel/git/gregkh/staging.git/commit/?h=staging-linusid=559c71fe5dc3bf2ecc55afb336145db7f0abf810 , that is why I think there is some problem with the mail itself. Sure I will wait :) regards, Ivo On 06.12.2013 09:32, Dan Carpenter wrote: On Fri, Dec 06, 2013 at 08:05:38AM +0200, Ivajlo Dimitrov wrote: Hi Greg, On 01.12.2013 19:07, Ivaylo DImitrov wrote: From: Ivaylo Dimitrov freemangor...@abv.bg Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't need to be exported. It can also be made way simpler by using sscanf. Signed-off-by: Ivaylo Dimitrov freemangor...@abv.bg --- drivers/staging/tidspbridge/Makefile |2 +- drivers/staging/tidspbridge/gen/uuidutil.c | 85 .../tidspbridge/include/dspbridge/uuidutil.h | 18 drivers/staging/tidspbridge/rmgr/dbdcd.c | 42 +- 4 files changed, 39 insertions(+), 108 deletions(-) delete mode 100644 drivers/staging/tidspbridge/gen/uuidutil.c I guess the initial mail somehow didn't make it through your spam filter: https://lkml.org/lkml/2013/12/1/70 It's too early to start resending. Wait for another week at least. regards, dan carpenter -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper
On 01.12.2013 21:06, Joe Perches wrote: On Sun, 2013-12-01 at 19:07 +0200, Ivaylo DImitrov wrote: From: Ivaylo Dimitrov Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't need to be exported. It can also be made way simpler by using sscanf. [] diff --git a/drivers/staging/tidspbridge/rmgr/dbdcd.c b/drivers/staging/tidspbridge/rmgr/dbdcd.c [] @@ -74,6 +74,40 @@ static int get_dep_lib_info(struct dcd_manager *hdcd_mgr, enum nldr_phase phase); /* + * dcd_uuid_from_string + * Purpose: + * Converts an ANSI string to a dsp_uuid. + * Parameters: + * sz_uuid:Pointer to a string that represents a dsp_uuid object. + * uuid_obj: Pointer to a dsp_uuid object. + * Returns: + * Requires: + * uuid_obj & sz_uuid are non-NULL values. + * Ensures: + * Details: + * We assume the string representation of a UUID has the following format: + * "12345678_1234_1234_1234_123456789abc". + */ +static void dcd_uuid_from_string(char *sz_uuid, struct dsp_uuid *uuid_obj) +{ + char c; + u64 t; + + /* +* sscanf implementation cannot deal with hh format modifier +* if the converted value doesn't fit in u32. So, convert the +* last six bytes to u64 and memcpy what is needed +*/ + sscanf(sz_uuid, "%8x%c%4hx%c%4hx%c%2hhx%2hhx%c%llx", + _obj->data1, , _obj->data2, , + _obj->data3, , _obj->data4, + _obj->data5, , ); + + t = cpu_to_be64(t); + memcpy(_obj->data6[0], ((char*)) + 2, 6); +} It'd probably be better to return true or false on successful conversion, use a temporary struct dsp_uuid, check the sscanf return is 10 and only copy to uuid_obj on success. Something like: static bool dcd_uuid_from_string(char *sz_uuid, struct dsp_uuid *uuid_obj) { char c; u64 t; struct dsp_uuid tmp; /* * sscanf implementation cannot deal with hh format modifier * if the converted value doesn't fit in u32. So, convert the * last six bytes to u64 and memcpy what is needed */ if (sscanf(sz_uuid, "%8x%c%4hx%c%4hx%c%2hhx%2hhx%c%llx", , , , , , , , , , ) != 10) return false; t = cpu_to_be64(t); memcpy([0], ((char*)) + 2, 6); *uuid_obj = tmp; return true; } If there is to be a return value from that function, it is better to be int (-EINVAL/0), IMO. And I am not sure that makes much of a sense, as (afaik) uuids are read from baseimage.dof and codec nodes, if those are broken I suspect wrong uuids will be our least problem. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper
On Sun, 2013-12-01 at 19:07 +0200, Ivaylo DImitrov wrote: > From: Ivaylo Dimitrov > > Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't > need to be exported. It can also be made way simpler by using sscanf. [] > diff --git a/drivers/staging/tidspbridge/rmgr/dbdcd.c > b/drivers/staging/tidspbridge/rmgr/dbdcd.c [] > @@ -74,6 +74,40 @@ static int get_dep_lib_info(struct dcd_manager *hdcd_mgr, > enum nldr_phase phase); > > /* > + * dcd_uuid_from_string > + * Purpose: > + * Converts an ANSI string to a dsp_uuid. > + * Parameters: > + * sz_uuid:Pointer to a string that represents a dsp_uuid object. > + * uuid_obj: Pointer to a dsp_uuid object. > + * Returns: > + * Requires: > + * uuid_obj & sz_uuid are non-NULL values. > + * Ensures: > + * Details: > + * We assume the string representation of a UUID has the following > format: > + * "12345678_1234_1234_1234_123456789abc". > + */ > +static void dcd_uuid_from_string(char *sz_uuid, struct dsp_uuid *uuid_obj) > +{ > + char c; > + u64 t; > + > + /* > + * sscanf implementation cannot deal with hh format modifier > + * if the converted value doesn't fit in u32. So, convert the > + * last six bytes to u64 and memcpy what is needed > + */ > + sscanf(sz_uuid, "%8x%c%4hx%c%4hx%c%2hhx%2hhx%c%llx", > +_obj->data1, , _obj->data2, , > +_obj->data3, , _obj->data4, > +_obj->data5, , ); > + > + t = cpu_to_be64(t); > + memcpy(_obj->data6[0], ((char*)) + 2, 6); > +} It'd probably be better to return true or false on successful conversion, use a temporary struct dsp_uuid, check the sscanf return is 10 and only copy to uuid_obj on success. Something like: static bool dcd_uuid_from_string(char *sz_uuid, struct dsp_uuid *uuid_obj) { char c; u64 t; struct dsp_uuid tmp; /* * sscanf implementation cannot deal with hh format modifier * if the converted value doesn't fit in u32. So, convert the * last six bytes to u64 and memcpy what is needed */ if (sscanf(sz_uuid, "%8x%c%4hx%c%4hx%c%2hhx%2hhx%c%llx", , , , , , , , , , ) != 10) return false; t = cpu_to_be64(t); memcpy([0], ((char*)) + 2, 6); *uuid_obj = tmp; return true; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper
On Sun, 2013-12-01 at 19:07 +0200, Ivaylo DImitrov wrote: From: Ivaylo Dimitrov freemangor...@abv.bg Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't need to be exported. It can also be made way simpler by using sscanf. [] diff --git a/drivers/staging/tidspbridge/rmgr/dbdcd.c b/drivers/staging/tidspbridge/rmgr/dbdcd.c [] @@ -74,6 +74,40 @@ static int get_dep_lib_info(struct dcd_manager *hdcd_mgr, enum nldr_phase phase); /* + * dcd_uuid_from_string + * Purpose: + * Converts an ANSI string to a dsp_uuid. + * Parameters: + * sz_uuid:Pointer to a string that represents a dsp_uuid object. + * uuid_obj: Pointer to a dsp_uuid object. + * Returns: + * Requires: + * uuid_obj sz_uuid are non-NULL values. + * Ensures: + * Details: + * We assume the string representation of a UUID has the following format: + * 12345678_1234_1234_1234_123456789abc. + */ +static void dcd_uuid_from_string(char *sz_uuid, struct dsp_uuid *uuid_obj) +{ + char c; + u64 t; + + /* + * sscanf implementation cannot deal with hh format modifier + * if the converted value doesn't fit in u32. So, convert the + * last six bytes to u64 and memcpy what is needed + */ + sscanf(sz_uuid, %8x%c%4hx%c%4hx%c%2hhx%2hhx%c%llx, +uuid_obj-data1, c, uuid_obj-data2, c, +uuid_obj-data3, c, uuid_obj-data4, +uuid_obj-data5, c, t); + + t = cpu_to_be64(t); + memcpy(uuid_obj-data6[0], ((char*)t) + 2, 6); +} It'd probably be better to return true or false on successful conversion, use a temporary struct dsp_uuid, check the sscanf return is 10 and only copy to uuid_obj on success. Something like: static bool dcd_uuid_from_string(char *sz_uuid, struct dsp_uuid *uuid_obj) { char c; u64 t; struct dsp_uuid tmp; /* * sscanf implementation cannot deal with hh format modifier * if the converted value doesn't fit in u32. So, convert the * last six bytes to u64 and memcpy what is needed */ if (sscanf(sz_uuid, %8x%c%4hx%c%4hx%c%2hhx%2hhx%c%llx, tmp.data1, c, tmp.data2, c, tmp.data3, c, tmp.data4, tmp.data5, c, t) != 10) return false; t = cpu_to_be64(t); memcpy(tmp.data6[0], ((char*)t) + 2, 6); *uuid_obj = tmp; return true; } -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] Staging: TIDSPBRIDGE: Remove UUID helper
On 01.12.2013 21:06, Joe Perches wrote: On Sun, 2013-12-01 at 19:07 +0200, Ivaylo DImitrov wrote: From: Ivaylo Dimitrov freemangor...@abv.bg Custom uuid helper function is needed only in rmgr/dbdcd.c and doesn't need to be exported. It can also be made way simpler by using sscanf. [] diff --git a/drivers/staging/tidspbridge/rmgr/dbdcd.c b/drivers/staging/tidspbridge/rmgr/dbdcd.c [] @@ -74,6 +74,40 @@ static int get_dep_lib_info(struct dcd_manager *hdcd_mgr, enum nldr_phase phase); /* + * dcd_uuid_from_string + * Purpose: + * Converts an ANSI string to a dsp_uuid. + * Parameters: + * sz_uuid:Pointer to a string that represents a dsp_uuid object. + * uuid_obj: Pointer to a dsp_uuid object. + * Returns: + * Requires: + * uuid_obj sz_uuid are non-NULL values. + * Ensures: + * Details: + * We assume the string representation of a UUID has the following format: + * 12345678_1234_1234_1234_123456789abc. + */ +static void dcd_uuid_from_string(char *sz_uuid, struct dsp_uuid *uuid_obj) +{ + char c; + u64 t; + + /* +* sscanf implementation cannot deal with hh format modifier +* if the converted value doesn't fit in u32. So, convert the +* last six bytes to u64 and memcpy what is needed +*/ + sscanf(sz_uuid, %8x%c%4hx%c%4hx%c%2hhx%2hhx%c%llx, + uuid_obj-data1, c, uuid_obj-data2, c, + uuid_obj-data3, c, uuid_obj-data4, + uuid_obj-data5, c, t); + + t = cpu_to_be64(t); + memcpy(uuid_obj-data6[0], ((char*)t) + 2, 6); +} It'd probably be better to return true or false on successful conversion, use a temporary struct dsp_uuid, check the sscanf return is 10 and only copy to uuid_obj on success. Something like: static bool dcd_uuid_from_string(char *sz_uuid, struct dsp_uuid *uuid_obj) { char c; u64 t; struct dsp_uuid tmp; /* * sscanf implementation cannot deal with hh format modifier * if the converted value doesn't fit in u32. So, convert the * last six bytes to u64 and memcpy what is needed */ if (sscanf(sz_uuid, %8x%c%4hx%c%4hx%c%2hhx%2hhx%c%llx, tmp.data1, c, tmp.data2, c, tmp.data3, c, tmp.data4, tmp.data5, c, t) != 10) return false; t = cpu_to_be64(t); memcpy(tmp.data6[0], ((char*)t) + 2, 6); *uuid_obj = tmp; return true; } If there is to be a return value from that function, it is better to be int (-EINVAL/0), IMO. And I am not sure that makes much of a sense, as (afaik) uuids are read from baseimage.dof and codec nodes, if those are broken I suspect wrong uuids will be our least problem. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/